On 3/17/2011 1:49 PM, dsimcha wrote:
== Quote from Walter Bright (newshou...@digitalmars.com)'s article
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.

This is better than nothing, but not enough to convince me to stop abusing
enforce().  I much prefer to have a real alwaysAssert() function that gives a
file, a line number and an error message.

if (!condition) { writeln("my message %s %s", __FILE__, __LINE__); assert(0); }

I am strongly opposed to using enforce() for bug detection.

Reply via email to