D array expansion and non-deterministic re-allocation

Walter Bright newshound1 at digitalmars.com
Mon Nov 16 01:40:30 PST 2009


Rainer Deyke wrote:
> Walter Bright wrote:
>> It's deterministic in the sense that if you run the program again with
>> the same inputs, you will get the same result. This is a highly useful
>> attribute for testing and debugging.
> On the same platform, with the same compiler, compiler settings, and
> standard library implementation.  That makes it harder to test, not
> easier.  You now have to test with multiple compilers.

That is still determinate. Indeterminate means you get different results 
if your run it again on the same machine.


>> It's safe as in memory safe. This is as opposed to undefined-behavior,
>> which is not memory safe. A buffer overflow is an example of
>> undefined-behavior.
> 
> The current behavior is unsafe in that you can accidentally have two
> variables pointing at the same buffer.  Let's say one buffer holds
> network input and the other holds some bytecode to execute.  Boom - a
> bug that can be exploited to execute malicious (byte-)code.

It is not two random arrays randomly sharing data.



More information about the Digitalmars-d mailing list