LRU cache for ~=
Don
nospam at nospam.com
Tue Oct 20 03:09:33 PDT 2009
Andrei Alexandrescu wrote:
> Rainer Deyke wrote:
>> Andrei Alexandrescu wrote:
>>> One surprising (but safe) behavior that remains with slices is this:
>>>
>>> void fun(int[] a) {
>>> a[0] = 0;
>>> a ~= 42;
>>> a[0] = 42;
>>> }
>>>
>>> The caller may or may not see 42 in the first slot after the call.
>>
>> Your definition of "safe" is clearly not aligned with mine.
>>
>
> What's yours?
"SafeD is easy to learn and it keeps the programmers away from undefined
behaviors." -- safed.html.
The behaviour you quoted is undefined behaviour, therefore it's not safe
according to the only SafeD definition in the spec.
More information about the Digitalmars-d
mailing list