return table from local resource

Timon Gehr timon.gehr at gmx.ch
Tue Jun 26 05:15:41 PDT 2012


On 06/26/2012 01:22 PM, monarch_dodra wrote:
> On Monday, 25 June 2012 at 12:01:22 UTC, Timon Gehr wrote:
>> On 06/25/2012 01:11 PM, bearophile wrote:
>>
>> It does. It is not fully implemented.
>
> Ok. That's good to know then. Thanks.
>
> Out of sheer curiosity, if I have "potentially dangerous code, eg"
>
> int[] fun(int i)
> {
>       int[3] statictab;
>       int[] dyntab = statictab; // [fixed]
>       if(i) dyntab = new int[3];;
>       return dyntab;
> }
>
>
> I expect my compiler to refuse to compile this, because this *could*
> produce undefined behavior. Is this correct?

Yes, the code snipped should be refused in @safe code.


More information about the Digitalmars-d mailing list