If you needed any more evidence that memory safety is the future...

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 26 00:14:33 PST 2017


On Sunday, 26 February 2017 at 06:02:59 UTC, Nick Sabalausky 
(Abscissa) wrote:
> On 02/26/2017 12:17 AM, Ola Fosheim Grostad wrote:
>> On Saturday, 25 February 2017 at 22:37:15 UTC, Chris Wright 
>> wrote:
>>> The undefined behavior is what happens after the would-be 
>>> assertion
>>> failure occurs. The compiler is free to emit code as if the 
>>> assertion
>>> passed, or if there is no way for the assertion to pass, it 
>>> is free to
>>> do anything it wants.
>>
>> No. That would be implementation defined behaviour. Undefined 
>> behaviour
>> means the whole program is illegal, i.e. not covered by the 
>> language at
>> all.
>>
>
> "Bad things happen" by a different name smells just as foul.

Most languages don't accept undefined behaviour, or rather, 
require it to be detected at either compile time or run time. Are 
there any languages outside the C family that that allows illegal 
programs to compile and run undetected under the assumption that 
such source code will never be compiled (assuming that the 
programmer will assure that this never happens)?

Implementation defined is different, as the spec can put can put 
constraints on the implementation, e.g. how a program terminates 
if you run out of memory might vary, but the spec might specify 
that an exception should be issued before terminating.



More information about the Digitalmars-d mailing list