preparing for const, final, and invariant

Walter Bright newshound1 at digitalmars.com
Thu May 17 19:35:45 PDT 2007


Manfred Nowak wrote:
> Walter Bright wrote
> 
>> Frank Benoit wrote:
>>> int[] g;
>>> void foo(in int[] a){
>>>     g = a.dup;    // allowed?
>>> }
>> Yes.
> 
> The `.dup'ing an array where a cell contains a reference to the array 
> is allowed too?
> 
> alias void* T;
> T[] a;
> void main(){
>   T[] g; g.length= 1;
>   g[0]=&g;
>   void f( in T[] p){
>     a= p.dup;
>   }
> }
> 
> That would contradict the given rule.

I don't understand. What rule is being violated, and how?



More information about the Digitalmars-d-announce mailing list