Afficher : Delphi C++
Préférences d'affichage

assert

De RAD Studio

Remonter à Assert.h - Index


Header File

assert.h

Category

Diagnostic Routines

Prototype

double asin(double x);
long double asinl(long double x);

Description

Tests a condition and possibly aborts.

assert is a macro that expands to an if statement; if test evaluates to zero, the assert macro calls the _assert function

void _RTLENTRY _EXPFUNC _assert(char * __cond, char * __file, int __line);

and aborts the program. The _assert function calls abort and asserts the following a message on stderr:

Assertion failed: test, file filename, line linenum

The filename and linenum listed in the message are the source file name and line number where the assert macro appears.

If you place the #define NDEBUG directive ("no debugging") in the source code before the #include <assert.h> directive, the macro expands to a no-op, the effect is to comment out the assert statement.

Return Value

None.

Example

#include <stdio.h>
#include <math.h>
int main(void)
{
   double result;
   double x = 0.5;
   result = asin(x);
   printf("The arc sin of %lf is %lf\n", x, result);
   return(0);
}

Portability

POSIX Win32 ANSI C ANSI C++

+

+

+

+

Outils personnels
Autres langues
Versions précédentes