[prog] C programming - capturing information sent to stdout

Kathryn Hogg kjh at flyballdogs.com
Fri Jul 15 04:59:39 EST 2005


Conor Daly said:
> But, in this case, you must _never_ use a function call inside an assert()
> because, when you compile with "-DNDEBUG", suddenly your function call
> doesn't happen.  So, instead of doing:
>
> assert(libinit());
>
> you do:
>
> result = libinit();
> assert(result == TRUE);

I always use the latter form because I can't find anything in the
documentation that states that assert() will evaluate its argument exactly
once.

-- 
Kathryn
http://womensfooty.com



More information about the Programming mailing list