public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jerry Van Baren <gvb.uboot@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] use of C99
Date: Wed, 08 Apr 2009 22:12:08 -0400	[thread overview]
Message-ID: <49DD5978.3090706@gmail.com> (raw)
In-Reply-To: <139940.41801.qm@web31807.mail.mud.yahoo.com>

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

  reply	other threads:[~2009-04-09  2:12 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-09  1:53 [U-Boot] use of C99 Pink Boy
2009-04-09  2:12 ` Jerry Van Baren [this message]
2009-04-09  5:50 ` Wolfgang Denk
2009-04-09 13:27   ` Larry Johnson
  -- strict thread matches above, loose matches on Subject: below --
2009-04-08 18:51 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49DD5978.3090706@gmail.com \
    --to=gvb.uboot@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox