this is of course Mr.Seebach's opionion. It may be better than most
opinions on C but it is still an opinion. I can live with camel case.
Actually I have to, as source bases I deal with in both C and C++ are
CamelCased. For reasons I'm not too sure about camelCase seems much
more prevelent in the C++ than the C world. You can reprogram yourself
to be equally happy in either.
Type prefixs on the other hand are Pure Evil. Search for Hungarian
Notation on the internet.
unless the rest of project team is using them. Or you're using an API
that uses them heavily (eg. Win32). I tend to hide Win32's programming
conventions away from the rest of my code as much as possible. And
only partly becasue they're ugly?
"Idiomatic" in this case refers to the broader category of C programming.
do you have figures?
Long story.
Idiomatic usage is an important thing, because people have to work on other
peoples' code. It is easier for everyone to write correct and efficient C
if people follow common conventions. The bulk of existing C has standardized
on names like do_some_things() rather than doSomeThings().
I've seen a fair amount that doesn't follow your conventions!
That means that,
in a large project, there will always be a fair amount of code which has
to refer to functions which have lowercase-and-underscores names.
not always...
If you use
camel case for your new functions, you've created a barrier to quick and
effective programming; someone who remembers the words "do some things"
has to *remember* which way you spelled them, rather than simply writing them
using the standard convention. This is of course caught mostly at compile
time, but it's a hassle and a distraction.
Type prefixes are in general stupid in a strongly-typed language.
oh agreed. stupid-stupid-stupid might be nearer the mark
They
distract the reader from the variable's function to interject with information
the reader probably already has readily at hand.
He should if he writes decent code. The variable you need to know the
type of should be either local or a parameter (and hence local again)
about 95% of the time. Which means it should only be about 20 lines
away at most (you do write functions that fit on a screen, yes?). Ok,
you may have some static stuff at the head of the file, but *that*
isn't far away either.
I know structs mess up this idealised world, but good naming naming
conventions and modularisation practices clean this all up. And you do
have a decent sourec code browser don't you?
adverbBasically, conjunctionIf nounYou verbFind pronounThis adjectiveReadable,
conjunctionMaybe pronounIt verbWorks prepositionFor pronounYou. For most
people, it doesn't work.
Consider this URL that discusses a common Hungarian Type in
Microsoft's Windows API
blogs.msdn.com/oldnewthing/archive/2003/11/25/55850.aspx
****************
What do the letters W and L stand for in WPARAM and LPARAM?
Once upon a time, Windows was 16-bit. Each message could carry with it
two pieces of data, called WPARAM and LPARAM. The first one was a 16-
bit value ("word"), so it was called W. The second one was a 32-bit
value ("long"), so it was called L.
You used the W parameter to pass things like handles and integers. You
used the L parameter to pass pointers.
When Windows was converted to 32-bit, the WPARAM parameter grew to a
32-bit value as well. So even though the "W" stands for "word", it
isn't a word any more. (And in 64-bit Windows, both parameters are 64-
bit values!)
It is helpful to understand the origin of the terms. If you look at
the design of window messages, you will see that if the message takes
a pointer, the pointer is usually passed in the LPARAM, whereas if the
message takes a handle or an integer, then it is passed in the WPARAM.
(And if a message takes both, the integer goes in the WPARAM and the
pointer goes in the LPARAM.)
Once you learn this, it makes remembering the parameters for window
messages a little easier. Conversely, if a message breaks this rule,
then it sort of makes your brain say, "No, that's not right."
*******************
In other words the Hungarian doesn't mean what it says it means.