Wish: Variable Not Used Warning
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Sun Jul 27 05:12:54 PDT 2008
Bill Baxter wrote:
> superdan wrote:
>> i don't think assert(0); is cool. in a release build it disappears
>
> Actually it does not disappear in release mode. assert(0) and
> assert(false) are always active. For better or worse, it's treated as a
> special case.
>
> --bb
What's "worse" about it? I think it actually makes sense.
The reason normal asserts are not put in release mode is for performance
reasons: so that the program doesn't waste time processing the assert
condition, when it could evaluate to true, and not generate an exception.
But when a program reaches an assert(false) it would always throw, and
you have a bug, so I see no reason for it to be removed in release code.
Unless you want your program to try to keeping going nonetheless
(instead of throwing), but I'm not sure that's a good idea, although I
guess it could work in some cases.
--
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list