This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: PATCH: Fix typo (and bootstrap failure) in jump.c


Mark Mitchell <mark@codesourcery.com> writes:

> Note that (as mentioned before) the best way to avoid this kind of
> thing is often to do:
> 
>   if (HAS_FOO) 
>     ...
>   else
>     ...
> 
> rather than:
> 
>   #ifdef HAS_FOO
>     ...
>   #else 
>     ...
>   #endif
> ...
> Does anyone object to making an effort to follow this style in the
> future?

In addition better error-checking, the `if (HAS_FOO)' style potentially
allows the same binary to be configured for multiple targets.  In that
case HAS_FOO would test a flag instead be a constant.

Gdb has gone through some effort to remove #ifdef-style conditional
compilation to support multiple architectures.  Of course for Gdb
there is an obvious benefit, since one can easily imagine wanting to
debug a distributed program that spans multiple architectures.  It is
less obviously useful being able to generate code for multiple
architectures at once.  Still, it is sometimes convenient, as shown by
the (more restricted) multi-architecture support in Gcc.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

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