4 ms·
For this reason I strongly prefer writing char const rather than const char Is there a reason to prefer the second version? It's a lot more popular
by vostok 10y ago
For this reason I strongly prefer writing
char const
rather than
const char
Is there a reason to prefer the second version? It's a lot more popular in my experience.
- Spivak 10y agoIt's the difference between "declare a constant integer" and "declare an integer constant" and to me the former more accurately represents what you're doing since `const` is modifying `int`, `int` isn't modifying `const`.
- kccqzy 10y agoPutting const on the right makes more sense when you have pointers or references. Then you just always read from right to left: `int const ` is a pointer to constant integer whereas `int const` is a constant pointer to integer. Also your argument about which modifies which is strongly anglocentric: there are plenty of people whose native language puts modifiers after the things they modify.