[prog] C programming - capturing information sent to stdout

Conor Daly conor.daly-linuxchix at cod.homelinux.org
Fri Jul 15 04:17:24 EST 2005


On Wed, Jul 13, 2005 at 09:20:57PM -0500 or so it is rumoured hereabouts, 
Kathryn Hogg thought:
> 
> Conor Daly said:
> > On Wed, Jul 13, 2005 at 08:59:16AM +1000 or so it is rumoured hereabouts,
> > Sue Stones thought:
> >> Kathryn Hogg wrote:
> 
> Some people say to use assertions liberally in development/testing and
> then turn it off in production by compiling with "-DNDEBUG"

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);

Conor
-- 
Conor Daly <conor.daly at oceanfree.net>

Domestic Sysadmin :-)
---------------------
Hobbiton.cod.ie
 19:14:09  up 7 days, 22:08,  1 user,  load average: 0.01, 0.02, 0.00


More information about the Programming mailing list