alwaysAssert() [was: Against enforce()]

Walter Bright newshound2 at digitalmars.com
Thu Mar 17 13:39:57 PDT 2011


On 3/17/2011 12:32 PM, dsimcha wrote:
> I've asked for this before and I'll ask again:  Can we **please** put an
> alwaysAssert() function (or an abbreviation of this to make it less verbose) in
> Phobos?  I proposed this once before and it wasn't well liked for some reason
> This reminded me to persist a little about it.

Not always the prettiest, but you can write:

     if (!condition) assert(0);

The assert(0) will be replaced with a HLT instruction even in release mode.


More information about the Digitalmars-d mailing list