assert semantic change proposal

Jeremy Powers via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 5 13:49:53 PDT 2014


>
>
>> Well, yes: Undefined behaviour in the sense
>>
> "And there will be no injection of undefined behaviour
>                                    ^~~~~~~~~~~~~~~~~~~
>                                    conventional sense
>
>
>  - the undefined behaviour is already there if the asserted constraints
>        ^~~~~~~~~~~~~~~~~~~
>        altered sense
>
> are not valid."
>


I still don't quite see your point.  Perhaps I should have said:  In the
case where an asserted constraint is not met, the program is invalid.
 Being invalid it has undefined behaviour if it continues.

>From another:

> There is a difference between invalid and undefined: A program is invalid
> ("buggy"), if it doesn't do what it's programmer intended, while
> "undefined" is a matter of the language specification. The (wrong)
> behaviour of an invalid program need not be undefined, and often isn't in
> practice.
>

I disagree with this characterization.  Something can be buggy, not doing
what the programmer intended, while also a perfectly valid program.  You
can make wrong logic that is valid/reasonable in the context of the program.

Invalid in this case means the programmer has explicitly stated certain
constraints must hold, and such constraints do not hold.  So if you
continue with the program in the face of invalid constraints, you have no
guarantee what will happen - this is what I mean by 'undefined'.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140805/f8d28b5a/attachment.html>


More information about the Digitalmars-d mailing list