const a storage class or a type modifier?

Jens Mueller jens.k.mueller at gmx.de
Fri Nov 26 05:56:07 PST 2010


Trass3r wrote:
> >Let's check all the possible cases:
> >void foo(const int *non_const_ptr_to_const,
> >         char *const const_ptr_to_non_const,
> >         const float *const const_ptr_to_const);
> >
> >In D2 you cannot express char *const. That's due to the transitivity of
> >const. You can only do a const char* which is a constant pointer to
> >constant.
> >That's why I think foo should become in D2
> >void foo(const int*, char *, const(float*));
> 
> Don't you mean foo(const(int)*, char*, const float*)?

Right. Found this out myself a minute ago.
Thanks.
And as you say const float* is equivalent to const(float*). You're
right const float* is better than const(float*).

Jens


More information about the Digitalmars-d mailing list