comp.lang.c
[Top] [All Lists]

Re: Mixed case?

Subject: Re: Mixed case?
From: Eric Sosman
Date: Wed, 30 Apr 2008 16:40:40 -0400
Newsgroups: comp.lang.c


s0suk3@xxxxxxxxx wrote:
I'm totally new to C, so this is a question from a total newbie. I
know most people write the names in C with underscores,
as_in_this_name. But... is it also customary to write them in mixed
case, asWithThisName? Or is it a horrible horrible horrible thing to
do??

    "Do what comes naturally."  If you like under_scores, use
under_scores.  If you like camelCase, use camelCase.  If you
like thingsruntogether, runthingstogether.  I'd encourage you,
as a beginner, to give all three styles (and others you may
find or invent) a try for a while, and see how it feels.

    A few rules, though:

    - If you're making changes to an existing program, use
      that program's prevailing style.  You may hate it, but
      if you depart from it the other programmers will hate
      you still more.

    - Stick with one style throughout one program or library;
      don't mix-and-match.

    - Steer clear of "reserved identifiers."  The C language
      assigns meaning to some identifiers like printf, and
      reserves the right to do so in the future with currently
      unused identifiers like straphanger and isosceles.  See
      http://www.oakroadsystems.com/tech/c-predef.htm for a
      list of some of these; it's out of date but will give
      a useful heads-up.

    - Most Of All: Do NOT!!! perpetuate that so-called
      "Hungarian notation" abomination, a reasonable idea
      that was twisted into a psychotic nightmare by weak-
      brained enthusiasts.

--
Eric.Sosman@xxxxxxx

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy