assert(0) behavior

Ali Çehreli via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 3 17:25:02 PDT 2015


On 08/03/2015 04:57 PM, Steven Schveighoffer wrote:

 > At the very least, assert(0, "message") should be a compiler error, the
 > message is unused information.

Agreed.

How about dumping the message to stderr as a best effort if the message 
is a literal? Hm... On the other hand, undefined behavior means that 
even trying that can cause harm like radiating a human with too much 
medical radiation. :(

Perhaps, if it is a complicated expression like calling format(), then 
it should be an error?

Ali



More information about the Digitalmars-d mailing list