assert(condition[, message]) patch
Walter Bright
newshound at digitalmars.com
Wed May 31 14:55:51 PDT 2006
Chris Miller wrote:
> On Wed, 31 May 2006 13:01:24 -0400, Walter Bright
>> ? You'll need to go look at the source anyway when the assert trips,
>> so what advantage is there to print the comment?
>
> How about when you have many versions of the program and source. Sure if
> you backup regularly and save them all you can eventually figure out
> which assert, but a message usually lets you find it in seconds.
I'm not sure what there is to figure out, it gives the source file and
line number. If you're using a decent IDE, it'll even automatically
bring up the source file and position the cursor on the offending line.
> I'd also be satisfied if it only used the assert expression as this
> message (and a trick could be used if one really wants: assert(foo &&
> "my message");).
More information about the Digitalmars-d
mailing list