[U-Boot] use of C99

Jerry Van Baren
2009-04-09T02:12:08Z

Pink Boy wrote:

[snip]

> 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

EWWWWwww. Quoting from Documentation/CodingStyle:

------------------------------------------------------------------------
Chapter 4: Naming

C is a Spartan language, and so should your naming be. Unlike Modula-2
and Pascal programmers, C programmers do not use cute names like
ThisVariableIsATemporaryCounter. A C programmer would call that
variable "tmp", which is much easier to write, and not the least more
difficult to understand.

[snip]

LOCAL variable names should be short, and to the point. If you have
some random integer loop counter, it should probably be called "i".
Calling it "loop_counter" is non-productive, if there is no chance of it
being mis-understood. Similarly, "tmp" can be just about any type of
variable that is used to hold a temporary value.

If you are afraid to mix up your local variable names, you have another
problem, which is called the function-growth-hormone-imbalance syndrome.
See chapter 6 (Functions).
------------------------------------------------------------------------

Best regards,
gvb