[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Base Operating System and Extensions Technical Reference, Volume 1

assert Macro

Purpose

Verifies a program assertion.

Library

Standard C Library (libc.a)

Syntax

#include <assert.h>
void assert (Expression)
int  Expression;

Description

The assert macro puts error messages into a program. If the specified expression is false, the assert macro writes the following message to standard error and stops the program:

Assertion failed: Expression, file FileName, line LineNumber

In the error message, the FileName value is the name of the source file and the LineNumber value is the source line number of the assert statement.

Parameters

Expression Specifies an expression that can be evaluated as true or false. This expression is evaluated in the same manner as the C language IF statement.

Implementation Specifics

This macro is part of Base Operating System (BOS) Runtime.

The assert macro uses the _assert subroutine.

Related Information

The abort subroutine.

The cpp command.

Subroutines Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]