Const sucks

Regan Heath regan at netmail.co.nz
Mon Sep 10 12:51:56 PDT 2007


Janice Caron wrote:
> Oh wait! I do have one comment, or question, or whatever.
> 
>> const int* p = &x;  // neither p nor *p can be changed
>> const(int*) p = &x;  // neither p nor *p can be changed
> 
> Two ways of writing the same thing. I don't understand the need for
> the bracketless version. Could we not just insist that the brackets
> must always be there? Or does the lack of brackets actually mean
> something? (if it does, it's back to being confusing again).

I thought the same thing.  I suspect the brackets will remain optional, 
but I reckon "good style" would require them.  For clarity if nothing else.

Regan



More information about the Digitalmars-d mailing list