const and immutable

BCS none at anon.com
Tue Jul 6 08:24:02 PDT 2010


Hello Tim,

> 
> I think I understand the difference between const and immuable when
> considering references and pointers, but how exactly is const
> different from immutable in:
[...]
> const(int) somefunc(); versus immutable(int) somefunc();

BTW both of those are pointless. The following works:

import std.stdio;
const(int) Fn(){return 0;}
void main()
{
   int i = Fn();
   i = 5;
   writef("%d\n", i);
}

-- 
... <IXOYE><





More information about the Digitalmars-d-learn mailing list