public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] use of C99
@ 2009-04-08 18:51 Kumar Gala
  2009-04-08 19:28 ` Wolfgang Denk
                   ` (2 more replies)
  0 siblings, 3 replies; 29+ messages in thread
From: Kumar Gala @ 2009-04-08 18:51 UTC (permalink / raw)
  To: u-boot

I was wondering if there was any reason we avoid C99 features in u- 
boot source.

Specifically the ability to declare variables in the middle of  
functions.

There are a slew of places that we have something like:

foobar()
{
...

#ifdef CONFIG_COOL_FEATURE
	u32 myvarrocks;
#endif

...

#ifdef CONFIG_COOL_FEATURE
	myvarrocks = foo * bar * bar;

	gd->neato = myvarrocks
#endif


it would be nice to just have:

foobar()
{

...

#ifdef CONFIG_COOL_FEATURE
	u32 myvarrocks = foo * bar * bar;

	gd->neato = myvarrocks
#endif

- k

^ permalink raw reply	[flat|nested] 29+ messages in thread
* [U-Boot] use of C99
@ 2009-04-09  1:53 Pink Boy
  2009-04-09  2:12 ` Jerry Van Baren
  2009-04-09  5:50 ` Wolfgang Denk
  0 siblings, 2 replies; 29+ messages in thread
From: Pink Boy @ 2009-04-09  1:53 UTC (permalink / raw)
  To: u-boot


Premi, Sanjeev sez,

> 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.

Pops out of hole, looks at shadow, 6 more weeks till we ship...

Um...  my feeling is that if one is going to declare a variable
inside a #ifdef then that variable ought to be called something
like

  int indx_CONFIG_COOL_FEATURE

and

  u32 indx_CONFIG_HOT_FEATURE

Matt Harper
Tehama Wireless

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2009-04-09 13:27 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-08 18:51 [U-Boot] use of C99 Kumar Gala
2009-04-08 19:28 ` Wolfgang Denk
2009-04-08 19:46   ` Jerry Van Baren
2009-04-08 20:25     ` Timur Tabi
2009-04-08 20:46       ` Premi, Sanjeev
2009-04-08 20:57         ` Timur Tabi
2009-04-08 21:26           ` Premi, Sanjeev
2009-04-08 21:34             ` Timur Tabi
2009-04-08 21:03         ` Ben Warren
2009-04-08 21:23           ` Premi, Sanjeev
2009-04-08 20:52       ` Scott Wood
2009-04-08 21:01         ` Timur Tabi
2009-04-08 22:26           ` Scott Wood
2009-04-08 21:34       ` Wolfgang Denk
2009-04-08 21:38         ` Timur Tabi
2009-04-08 22:39           ` Graeme Russ
2009-04-08 22:45             ` Timur Tabi
2009-04-08 22:59               ` Wolfgang Denk
2009-04-08 23:09                 ` Scott Wood
2009-04-08 22:28         ` Scott Wood
2009-04-08 21:27     ` Wolfgang Denk
2009-04-08 23:22 ` Larry Johnson
2009-04-08 23:40   ` Scott Wood
2009-04-09  4:27 ` Kumar Gala
2009-04-09 11:38   ` Jerry Van Baren
  -- strict thread matches above, loose matches on Subject: below --
2009-04-09  1:53 Pink Boy
2009-04-09  2:12 ` Jerry Van Baren
2009-04-09  5:50 ` Wolfgang Denk
2009-04-09 13:27   ` Larry Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox