This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: (patch) hpjyg21: FAT_FREE_PSYMTABS



   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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]