Subject: | |
From: | |
Reply To: | |
Date: | Wed, 11 Jun 1997 15:46:31 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Stan Sieler writes:
> But...back to Lee's question. I, too, thought there was a mechanism
> to get procedure-relative statement numbers into the C generated
> object code...but I can't remember it, or find it.
Well, a special case that does this would be the assert() function (cut/pasted
from LaserRom):
assert
Terminates the program if the assertion is false.
Syntax
#include <assert.h>
void assert (int expression);
Parameters
expression An integer value to be evaluated.
Return Values
None.
Description
The assert macro terminates the program if the assertion is false. The
assert macro takes a single integer (expression) argument. If the
expression evaluates to 0 (false), assert() writes a message containing
the expression that tested false and the line number where the assert
occurred. The program then terminates. The macro NDEBUG is referenced
but not defined in <assert.h>. If NDEBUG is defined at the point when
<assert.h> is included, the assert macro calls have no effect. The
NDEBUG macro enables the operation of the assert macro:
--------------------------------------------------------------------------------------------
| | |
| NDEBUG Definition | assert macro effect |
| | |
--------------------------------------------------------------------------------------------
| | |
| Defined | Calls are ignored (no debugging done) |
| | |
| Undefined | Calls are processed (debugging is done) |
| | |
--------------------------------------------------------------------------------------------
See Also
abort(), ANSI C 4.2.1.1, POSIX.1 8.1
--
Mark Bixby E-mail: [log in to unmask]
Coast Community College Dist. Web: http://www.cccd.edu/~markb/
District Information Services 1370 Adams Ave, Costa Mesa, CA, USA 92626-5429
Technical Support +1 714 438-4647
"You can tune a file system, but you can't tune a fish." - tunefs(1M)
|
|
|