DMD 1.025 and 2.009 releases

naryl cy at ngs.ru
Sat Jan 12 15:25:30 PST 2008


On Sat, 12 Jan 2008 23:26:58 +0300, torhu <no at spam.invalid> wrote:

> eao197 wrote:
> I've modified 3 lines in your main function:
>
>> void
>> main()
>>    {
>>      void show( Message m )
>         void show( in Message m )
>
>>        {
>>          writefln( &m.notifier, ": ", m.notifier.i );
>             writefln( cast(Notifier*)&m.notifier, ": ", m.notifier.i );
>
>>        }
>>       auto m1 = new Message( new Notifier( 1 ) );
>>      show( m1 );
>>       auto m2 = new invariant(Message)( new Notifier( 2 ) );
>         auto m2 = cast(invariant) new Message( new Notifier( 2 ) );
>
>>      show( m2 );
>>      m2.notifier = new Notifier( 3 );
>>      show( m2 );
>>    }
>>
>
> With these changes, I get the error "Error: cannot modify  
> const/invariant m2.notifier".

But what 'new invariant(Message)' is supposed to do? I can't find it in  
the docs.



More information about the Digitalmars-d-announce mailing list