News for hackers. Stuff that matters.
Re:The C++ Programming Language (4th Edition) by comex on Saturday May 11, 2013 @09:32PM (#5692777)
for the record, const const * is redundant. I think const is only so confusing because you can write it two different ways (char const * vs. const char *); if only the former was allowed, it would seem a lot more logical.
Re:The C++ Programming Language (4th Edition) by n00b101 on Sunday May 12, 2013 @12:47AM (#5693196)
int* - pointer to int.

int const * - pointer to const int.

int * const - const pointer to int.

int const * const - const pointer to const int.

Is that so hard? Those people posting here who think that THIS is the hardest problem in computing should perhaps find a new line of work.

Re:The C++ Programming Language (4th Edition) by comex on Sunday May 12, 2013 @01:25AM (#5693258)
Exactly: if 'int const * ' were common, it would be relatively clear that const goes after the type of the thing that is const - but the overwhelming use of the alternate form, 'const int *', makes it more confusing what to do.
Re:The C++ Programming Language (4th Edition) by n00b101 on Sunday May 12, 2013 @01:46AM (#5693298)
const int * - pointer to const int

I see this is as

(const int)* foo;

which is the same as

(int const)* foo;

And people prefer

const int foo;

over

int const foo;

So it all makes sense in terms of the grammar. Admittedly, it can be difficult to remember, but pointers and const correctness are complicated and combining them is going to be complicated to write out no matter what grammar you use. Even if the grammar was restricted, it's difficult to remember this type of thing and if you encountered such code in the wild and had any doubts about its semantics then you would look it up on Google before modifying it (right?)