On 7/27/2016 12:28 AM, Shachar Shemesh wrote:
On 27/07/16 10:14, Walter Bright wrote:
Thank you. I'd prefer it to say something along the lines that it stops
execution at the assert(0) in an implementation-defined manner. This
leaves whether messages are printed or not, etc., up to the
implementation. I don't think the spec should require more than that
(for example, some uses may have no means to print an error message).

I would ask that it at least be a "recommends". This message is muchu useful,
and finding out it is not displayed in DMD release mode was a major 
disappointment.

Updated proposed text:
The expression assert(0) is a special case; it signifies code that should be
unreachable. Either AssertError is thrown at runtime if reached or execution
terminated. In the later case, it is recommended that the implementation print
the assert message to stderr (or equivalent) before terminating. The
optimization and code generation phases of the compilation may assume that any
code after the assert(0) is unreachable.

Shachar

Production of error messages is out of the purview of the core language specification, since it is highly dependent on the runtime environment, and the spec shouldn't get into Quality Of Implementation issues. Hence,

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

Reply via email to