Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function
monarch_dodra via Digitalmars-d
digitalmars-d at puremagic.com
Sat Oct 11 10:27:20 PDT 2014
On Saturday, 11 October 2014 at 12:45:40 UTC, Dicebot wrote:
> On Saturday, 11 October 2014 at 07:36:21 UTC, monarch_dodra
> wrote:
>>> Wait what? Are you saying there is a single case when this:
>>>
>>> const T var;
>>>
>>> is not identical to this:
>>>
>>> const(T) var;
>>
>> No, look at the pointer symbol.
>
> module test;
>
> const int** a;
> const(int**) b;
The original code you quoted was "const(T)* v;" where the "*" was
*outside* of the parens.
> **a = 42;
> Error: cannot modify const expression **a
>
> 0000000000000000 B _D4test1axPPi
> 0000000000000008 B _D4test1bxPPi
>
> ???
>
> Can you give an examle of the code that actually observes the
> semantical difference?
I cannot. I was trying to prove that there isn't, after you made
the statement "Wait what? Are you saying there is a single case
when this is not identical to this".
More information about the Digitalmars-d
mailing list