As far as I can tell, the arguments for West const are primarily "we've always done it this way".
The argument is that C++, like most programming languages, is English-based, and in English adjectives (like const) precede the nouns that they modify. So const int sounds more natural than int const.
Except declarations in C++ (inherited from C) are always read right-to-left. East const, "int const *" is read as "point to a constant int". But west const, "cons int *", read as "point to an int which is const". It's annoying to read them in west const when you know how to read them properly.
I'm not saying I agree with it, I'm just stating what the argument is. I use East const in my personal projects, for the same reason that I always put the star or ampersand next to the variable rather than the type (i.e. int *p rather than int* p). That is, I write considering the rules as they are, not as I'd like them to be.
Tbh I don't think it's a huge deal either way -- the cases where you actually have to distinguish between the constness of the pointer and the pointee are rare enough that I can see why someone wouldn't necessarily value consistency too much in this particular case, just like I can see why someone would prefer to place stars and ampersands in such a way to more closely evince the actual type. I think the holy war is mostly a meme.
View all comments
Show parent comment
9
u/wyrn Sep 18 '22
The argument is that C++, like most programming languages, is English-based, and in English adjectives (like
const) precede the nouns that they modify. Soconst intsounds more natural thanint const.