This is the mail archive of the gdb@sourceware.org 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]
Other format: [Raw text]

Re: Switch -Wunused-variable on?


On Wed, 25 Apr 2012, Andreas Schwab wrote:

> > -- "i" is now live in all cases and also IMHO handle_frobnication is more 
> > readable.
> 
> It also requires an unconditional declaration and definition of
> target_frobnicate_harder.

 Yes, but do you see at as advantage or disadvantage?

 Please note that my example can be easily adapted to a three-way choice 
where the value of target_frobnicate_harder can only be determined at the 
run time, e.g.:

#ifdef TARGET_NEEDS_HARD_FROBNICATION
#define target_needs_hard_frobnication 1
#else if defined TARGET_SUPPORTS_HARD_FROBNICATION
int target_needs_hard_frobnication;
#else
#define target_needs_hard_frobnication 0
endif

and then you still have all the conditional bits localised here and don't 
have to modify handle_frobnication at at all. :)

  Maciej


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