assert(3C)assert(3C)NAME
assert - verify program assertion
SYNOPSIS
#include <assert.h>
void assert(int expression);
The assert() macro inserts diagnostics into applications. When executed, if expression is FALSE (zero), assert() prints the error message
Assertion failed: expression, file xyz, line nnn
on the standard error output and aborts. In the error message, xyz is the name of the source file and nnn the source line number of the
assert() statement. These are respectively the values of the preprocessor macros __FILE__ and __LINE__.
Since assert() is implemented as a macro, the expression may not contain any string literals.
Compiling with the preprocessor option -DNDEBUG (see cc(1B)), or with the preprocessor control statement #define NDEBUG ahead of the
#include <assert.h> statement, will stop assertions from being compiled into the program.
Messages printed from this function are in the native language specified by the LC_MESSAGES locale category. See setlocale(3C).
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
cc(1B), abort(3C), gettext(3C), setlocale(3C), attributes(5), standards(5)
30 Mar 2005 assert(3C)
Check Out this Related Man Page
assert(3) Library Functions Manual assert(3)NAME
assert - Inserts program diagnostics
LIBRARY
Standard C Library (libc.a, libc.so)
SYNOPSIS
#include <assert.h>
void assert(
int expression) ;
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
assert(): XPG4, XPG4-UNIX
Refer to the standards(5) reference page for more information about industry standards and associated tags.
PARAMETERS
Specifies an expression that is evaluated as TRUE or FALSE. This expression is evaluated in the same manner as a C language if control
statement.
DESCRIPTION
The assert() macro inserts diagnostics into programs. On execution, when the expression parameter is false (returns FALSE), this macro
writes information about the particular call that failed, including the text of the argument, the name of the source file, and the source-
file line number (the latter two are respectively the values of preprocessing macros __FILE__ and __LINE__) on stderr. The error message
is taken from the standard C library message catalog. The assert() macro then calls the abort() function to (normally) terminate the
process.
When you compile a program with the -DNDEBUG preprocessor option, or with the #define NDEBUG preprocessor control statement before the
#include <assert.h> statement, calls to the assert() macro have no effect.
RETURN VALUES
The assert() function returns no value.
RELATED INFORMATION
Routines: abort(3)
Standards: standards(5) delim off
assert(3)
im trying to remove all occurences of " OF xyz " in a file where xyz could be any word assuming xyz is the last word on the line but I won't always be.
at the moment I have sed 's/OF.*//'
but I want a nicer solution which could be in pseudo code
sed 's/OF.* (next token)//'
Is... (6 Replies)
I have been doing this:
make xyz &> xyz.log &; tail -f xyz.log
The problem with this is that you never can ge sure when "make xyz" is done.
How can I pipe both stderr and stdout into tee so both stderr and stdout are copied both to the display and to the log file?
Thanks,
Siegfried (3 Replies)
How do i substitute ' with space in a file using sed or awk
i am getting the following two scenarios
1) xyz'd with xyz d
if i use
sed 's/xyz\\\'d/xy z/g'
it is taking ' after \ as closing expr for substitution
2) xyz';d with xyz d
please advice (8 Replies)
Hi,
I need and expression for a word like abc_xyz_ykklm
The expresion should indicate that the word starts with abc and end with ykklm but does not contain xyz string in the middle.
Example: abc_tmn_ykklm is ok and abc_xyz_ykklm is not Ok.
Please help.
Regards. (1 Reply)
Hello,
I have a file like this:
FILE.TXT:
(define argc :: int)
(assert ( > argc 1))
(assert ( = argc 1))
<check>
#
(define c :: float)
(assert ( > c 0))
(assert ( = c 0))
<check>
#
now, i want to separate each block('#' is the delimeter), make them separate files, and then send them as... (5 Replies)
Hi, I am rather new to Unix/Linus. I have this problem that I would like to solve using unix.
Here is what I have
start stop expression
1 5 15
2 6 10
I want a output like this
position expression
1 15
2 25
3 ... (1 Reply)
Hi all,
I've been searching the internet and can't find an answer to this. Im trying to figure out how to negate a whole expression befor an if. I'll explain below.
Let's say
x=0
y=1
] (this is false) I would like to negate this whole boolean condition. To negate the above... (4 Replies)
Hi,
Just wondering if it is possible to trim the file path output by __FILE__ preprocessor in my debugging line.
Let's say my main.cpp file is found in C:\User\MyName\SystemA\Mod1\SubMod2\Test\main.cpp
for __FILE__, I just want the filename - main.cpp to be printed, instead of the entire... (2 Replies)
I'm sorry if the title is really criptic, but I don't know how to phrase my problem.
I know I can't really ask for a solution, and I normally wouldn't but this is really escaping my abilities.
Antefacts.
I developed a program using the zeromq messaging library.
I got to a point where the... (11 Replies)
Discussion started by: erupter
11 Replies
14. Forum Support Area for Unregistered Users & Account Problems
Hi, i got several questions regarding Solaris 10 configuration which i would like to ask here. Unfortunately Russia is blacklisted so I cannot register the normal way.
My IP is: 5.19.nnn.nnn
email: <removed>
Thank you. (5 Replies)
Hi, I have two TEST files t.xyz and a.xyz which have three columns each. a.xyz have more rows than t.xyz. I will like to output rows at which $1 and $2 of t.xyz match $1 and $2 of a.xyz. Total number of output rows should be equal to that of t.xyz.
It works fine, but when I apply it to large... (6 Replies)