Exactly -- I'm a staunch member of the "7 == x" camp. I just tried to
explain why, as I perceive, Seebs thinks what he thinks. (Sorry if this
qualifies as bad etiquette.)
Are you a staunch member of the '7 == x' because of style, or because
of the possibility of catching '7 = x' errors? I personally don't
like the style simply because it *is* more mind taxing, and it's a
result of not seeing code in that style, not writing code in that
style, and not thinking about code in that style, for about 8 years
between C++ and C, that my brain has been conditioned that way. I
would be bold enough to say that a large majority of C programmers are
conditioned that way, simply from other people's code and books that
I've seen.
Perhaps you would allow me to scramble the characters on your keyboard
in a way of my choosing that is better? Let's take 'asdfjkl;' and
make it 'arstenil' since those d, f, j, k, and ';' characters are used
much less often, and it requires more finger movement, causing more
cases of carpal tunnel syndrome. Would you be willing to give that a
try? The example is a bit hyperbolish, but that's how it feels to me
looking at '7 == x'.
And the thing is that you may actually like that keyboard better, but
everyone else will still use the standard keyboard, and still complain
if they have to use your keyboard. The inertia of the original style
'x == 7' is too large enough to overcome unless that style has
generated so many problems that I'm motivated to try out '7 == x'. If
you suffered from carpal tunnel syndrome, you may be tempted to give
the new keyboard a try.
I actually went through this process with single line if statements.
if ( condition )
statement;
I have been bitten by this syntax (spending hours pouring over code
where my brain is not registering the syntax error) so many times that
the bracket style
if ( condition ) {
statement;
}
has become my convention. It has saved me time because for whatever
reason, my brain can deal with the syntax errors better.
Lastly, I have no problem with someone wanting to use '7 == x' if it
really does help them from a style perspective. I have an issue when
people use the style just to catch '7 = x' errors when 'x == 7' would
be easier to understand. Hey, I still use 'char* p' simply because I
started in C++ and moved to C, and it's easier for me to use. I'm
sure there are a host of people that will belittle me for still using
that syntax, and I realize I may be in the minority, but I'll still
keep using it since it's more work to relearn and restyle the code
I've already written than to appease the majority.
Again, if I have to work with a team, and it's decided to use 'char
*p', I will gladly acquiesce, but unless I'm forced to code that way
for a long time, I don't foresee myself changing my ways.
Best regards,
John D.