D array expansion and non-deterministic re-allocation

Rainer Deyke rainerd at eldwood.com
Mon Nov 16 00:58:25 PST 2009


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.

> 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.


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list