This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: (patch) hpjyg21: FAT_FREE_PSYMTABS
- To: cagney at cygnus dot com
- Subject: Re: (patch) hpjyg21: FAT_FREE_PSYMTABS
- From: Stan Shebs <shebs at cygnus dot com>
- Date: Thu, 11 Nov 1999 15:41:27 -0800
- CC: gdb-patches at sourceware dot cygnus dot com, guo at cup dot hp dot com
Date: Fri, 12 Nov 1999 10:10:14 +1100
From: Andrew Cagney <ac131313@cygnus.com>
I've another meta maintainer question on this :-)
Is it better to use #ifdef or have the compiler eliminate optional
code? For instance:
if (FAT_FREE_PSYMTABS)
{
}
I favor this over ifdefs. Not only does it facilitate maintenance,
but it leaves open options for cross-debugging and for making
decisions at runtime. The only reasonable exception would be provably
time-critical code where ifdefs would allow compiler optimizations not
available if the code were merely "if (0)". (There might be examples
of this in the stabs reader, although I don't know of any myself.)
If the compiler does the elimination (instead of CPP) the code is always
being checked and hence less likely to suffer bit rot.
Yes I know it's something of a radical departure from the existing
conventions.
A departure from habit, true, but there's not a rule that says "use
more ifdefs". Ifdefs are the easy way out, but we want to go the
right way, not the expedient way.
Stan