lkml.org 
[lkml]   [2001]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRE: [OT?] Coding Style
At 10:47 AM 1/23/01 -0600, Jesse Pollard wrote:
>Code is written by the few.
>Code is read by the many, and having _ in there makes it MUCH easier to
>read. Visual comparison of "SomeFunctionName" and "some_function_name"
>is faster even for a coder where there may be a typo (try dropping a
>character)
>or mis identifing two different symbols with similar names:
>
> d_hash_mask
> d_hash_shift
>
>This is relatively easy to read. conversely:
>
> DHashMask
> DHashShift
>
>Are more difficult to spot.

Depends on what you are used to. I'm used to both, being both an old-world
C programmer from the very beginning (where underscore was the preferred
way) and also a Pascal programmer (where the mixed-case form was the
preferred way). Remember a language where dollar signs broke up words?

But then again, one reason I'm so fond of structures is that you can get
away from the whole thing by being able to read

d.hash.mask
d.hash.shift

(It's really too bad that you can't have structured enum constants, isn't it?)

By the way, just so everyone hates me, I would tend to key the above two
names as

DHash_mask
DHash_shift

so that, as another person has commented, you identify the class of a
variable and the specifics as easily identifiable entities. That assumes
that your "class" names are sufficiently different that a mis-key will be
caught by that master of book-keeping, the compiler.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:21    [W:0.044 / U:5.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site