P
Philip Potter
Frederick Gotham said:Keith Thompson posted:
English is quite strange in that regard. I think most languages put their
words in order of descending importance. Irish for example:
window = fuinneog
small = beag
small window = fuinneog bheag
I think it makes sense to receive information in order of descending
importance. I like to know the type first and foremost, which is why I
prefer:
int const i = 5;
over:
const int i = 5;
It doesn't make much of a difference with small, simple, definitions, but
it certainly does work nice with long unwiedly ones.
And who defines importance? You, as a C++ programmer, should know that
sometimes type doesn't even matter. (That's why templates were created.)
Sometimes I'm much more interested in the fact that a variable is const than
the fact that it is an int. *Every* piece of information in the declaration
becomes important at some point.
Sticking to a common coding style between multiple programmers on the same
project makes looking for the piece of information you want *right now* much
easier. It's far more important to stick to a common coding style than to
invent a new one which you think is better but which nobody else is used to.
Since you are a lone programmer, agreement on your common coding style
becomes much easier and you can use whatever coding style you like.
I wouldn't have thought people would be so puzzled by the simple ordering
of words.
I can see exactly why you and Keith keep disagreeing in this respect. You
are saying that the code has exactly the same information as before, so any
programmer worth his salt would be able to work out what the declaration
meant, whatever the word order. And you're right. It certainly is still just
as possible to get the same information.
However, the same programmer, when presented with a word order he is not
familiar with, will take longer to read it, and will have to think more, and
(quite possibly) will be frustrated by this fact. The code is not
unreadable; but it *is* less readable.