Const spec status.

Bruno Medeiros brunodomedeiros+spam at com.gmail
Mon Apr 28 16:09:37 PDT 2008


Janice Caron wrote:
> On 27/04/2008, Bruno Medeiros <brunodomedeiros+spam at com.gmail> wrote:
>>  and tell which ones you think are valid and which are not. Before running
> Here goes:
> 
>>         int a = inv_num;
> OK
> 
>>         invariant(int) b = num;
> OK
> 
> 
>>         const(int)[] c = inv_intArray;
> OK
> 
>>         int[] d = inv_intArray;
> ERROR
> 
>>         Object e = inv_object;
> ERROR
> 
>>         Struct f = inv_Struct;
> OK

Both you and Simen got it right.
Hum, I feel a bit silly, I originally thought that *all* cases would be 
an error, so maybe it was just I that got confused with a previous 
version of const. (where values could only be assigned to variables with 
the same "head-constness", which is not the case here)

-- 
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list