Article View: comp.std.c++
Article #1650Re: problem with assertions
From: Nick Mein
Date: Mon, 07 Aug 1995 23:44
Date: Mon, 07 Aug 1995 23:44
25 lines
1130 bytes
1130 bytes
[Followups directed to comp.lang.c++]
STIOO (stioo@ift.ulaval.ca) wrote:
: BOOL bSuccess = bTrySomething();
: assert(bSuccess); // I kwnow it must be a success.
: When I remove the assert statement (undefining a keyword) I get
: a compiler warning: "bSuccess declared but not used".
: Is there another writing style that avoids such a message?
Microsoft's MFC defines a VERIFY macro which works as an assert, but
when _debug is undefined the expression is still evaluated for its side
effects. Ie, you would use:
verify(bTrySomething());
--
Nick Mein
MSc Student
Dept of Computer Science
University of Otago
Dunedin
New Zealand.
Technical Details
Message-ID:
<4068g9$ac3@celebrian.otago.ac.nz>Path:
arc1-ca.pugleaf.net!bifrost.otago.ac.nz!nmeinReferences:
<3vttrm$nc2@athena.ulaval.ca>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!bifrost.otago.ac.nz!nmein From: nmein@bifrost.otago.ac.nz (Nick Mein) Newsgroups: comp.std.c++ Subject: Re: problem with assertions Followup-To: comp.lang.c++ Date: 7 Aug 1995 23:44:09 GMT Organization: University of Otago, Dunedin, NZ Distribution: world Message-ID: <4068g9$ac3@celebrian.otago.ac.nz> References: <3vttrm$nc2@athena.ulaval.ca> NNTP-Posting-Host: bifrost.otago.ac.nz X-Newsreader: TIN [version 1.2 PL2]