My coworker is 0 for 2 on questions inspired by him (1, 2), so I decided to give him a chance to catch up.
Our most recent argument is about the placement of "const" on declarations.
He believes it should be placed either in front of the type or after the pointer.
The explanation is that this is what everyone else does, and different styles are likely to be confusing.
Thus, a constant pointer to int and a constant pointer to int would be:
const int *i;
int * const i;
Nonetheless, I'm perplexed.
I need rules that are consistent and simple to comprehend, and the only way I can understand "const" is because it comes after the object it modifies.
There is an exception that permits it to come before the final type, but it's an exception, so I'd rather not use it.
Thus, a constant pointer to int and a constant pointer to int would be:
int const * i;
int * const i;
Doing things this way also makes deeper degrees of indirection easier to grasp.
A pointer to a constant pointer to int, for example, would plainly be:
int * const * i;
My thesis is that if someone learns it his way, they'll have no problem calculating what the above amounts to.
The main problem here is that he believes that placing const after int is so hideous and detrimental to reading that it should be prohibited in the style guide.
Of course, I believe the guide should recommend doing things my way, but we should not exclude one method.