What is the difference between...

Sean Kelly sean at f4.ca
Fri Sep 7 07:19:14 PDT 2007


Sean Kelly wrote:
> Daniel Keep wrote:
>>
>>> (2) void f(const(int*) x)
>>
>> Ok, now you've got a mutable read-only view: the bits of 'x' can be
>> changed, but the data referenced by x cannot.
> 
> I thought that's what 'final' was for.  For the above, I'd expect the 
> reference and the data to which it refers to both be immutable through 
> x.  Is this not right?

er, let me clarify.  I would assume that:

const(int)* x

means that the data cannot be changed but the pointer can.  But by 
enclosing the pointer in parens, it should be considered constant as well.


Sean



More information about the Digitalmars-d mailing list