[U-Boot] use of C99

Premi, Sanjeev premi at ti.com
Wed Apr 8 23:26:26 CEST 2009


> -----Original Message-----
> From: Timur Tabi [mailto:timur at freescale.com] 
> Sent: Thursday, April 09, 2009 2:28 AM
> To: Premi, Sanjeev
> Cc: Jerry Van Baren; U-Boot-Users ML; Kumar Gala
> Subject: Re: [U-Boot] use of C99
> 
> Premi, Sanjeev wrote:
> 
> > One of the biggest problem is uncontrolled variable definitions that
> > gets even nasty when variables have same names with different types;
> > though under different set of #ifdefs. Quite possible for commonly
> > used variable names - i, ptr, tmp, etc.
> 
> Then let's just say that if you're going to define a variable in the
> middle of a function, it can't have the same name as another 
> variable in
> that function.
> 
> > I feel, here, ifdefs provide a false sense of 'enclosure' 
> with possibility
> > of frequent breaches - in code (while implementing) and in 
> simple reading 
> > (for understanding).
> 
> Sorry, I don't understand what you're talking about.  The #ifdefs are
> used to enable feature-specific code on platforms that have 
> that feature.

I was referring to declaring variable within #ifdefs with belief that
use will be contained.

e.g.
#ifdef CONFIG_COOL_FEATURE
 	int i;
      int* ptr ;
      ...
      ...
#endif

...
... 2 screenful down; in same function...
...

#ifdef CONFIG_HOT_FEATURE
 	u32 i;
      void* ptr;
      ...
      ...
#endif

Maybe for sometime the usage seems contained. Until someone decides to have
both the COOL and HOT feature.

~sanjeev
> 
> -- 
> Timur Tabi
> Linux kernel developer at Freescale
> 
> 


More information about the U-Boot mailing list