Overflows in Phobos
qznc via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 27 15:47:34 PDT 2016
On Wednesday, 27 July 2016 at 07:59:54 UTC, Walter Bright wrote:
> "The expression assert(0) is a special case; it signifies code
> that should be unreachable. If it is reached at runtime, either
> AssertError is thrown or execution is terminated in an
> implementation-defined manner. Any code after the assert(0) is
> considered unreachable."
Why that last phrase about "considered unreachable"? If
"AssertError is thrown or execution is terminated" it implies
that execution will not continue after assert(0).
Also "Any code after the assert(0)" is somewhat ambiguous about
"after". Consider:
if (random) goto twist;
assert(0);
twist: writeln("after assert(0)?!");
And also:
try { assert(0); }
catch (AssertError e) { writeln("after assert(0)?!"); }
More information about the Digitalmars-d
mailing list