Hi Monty, all
On 24/03/2011, at 6:40 AM, Monty Taylor wrote:
There has been a decent amount of discussion back and forth on Olaf's
proposal of adding a common_fwd.h header with forward decls of classes
and structs and such.
At first I was pretty lukewarm to this, mainly due to worry about a
global header that had to be included before other headers and the
nonsense that took us forever to unwind from my_global.h from mysql.
The more I thought about it and the more I talked with Olaf though,
I am
now in favor of the idea... especially since I think it's a great step
one in getting us further along towards untangled headers. Consider
this
process:
Make a common_fwd.h header which literally has forward decls for
everything
Make a branch which removes ALL includes from ALL files and replaces
them with common_fwd.h... then, as obviously nothing will compile at
that point, anything that's undefined at that point would be something
that actually needed a header.
Sounds sane and from my experience (I applied the above approach for a
biggish project approx 20 years ago) the results are good.
Depending on environment oddities, you can end up with conflicting
declarations in different source files. No longer possible with this.
Declaration changes often require a clean rebuild. This enforces that
implicitly in the make system, avoiding failed builds.
In some cases it requires a slightly modified development approach
(avoid the temptation of resolving them all with #ifdefs in
common_fwd.h ;-) but I think it does improve things. I think
my_global.h had gone evil, but the underlying idea was not wrong.
Cheers,
Arjen.
--
Arjen Lentz, Exec.Director @ Open Query (http://openquery.com)
Remote expertise & maintenance for MySQL/MariaDB server environments.
Follow us at http://openquery.com/blog/ & http://twitter.com/openquery
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp