O nás     Inzerce     KontaktSpolehlivé informace o IT již od roku 2011
Hledat
Nepřehlédněte: Usnadní vám práci: Pozoruhodné IT produkty pro rok 2024
Správa dokumentů
Digitální transformace
Informační systémy
Hlavní rubriky: Informační systémy, Mobilní technologie, Datová centra, Sítě, IT bezpečnost, Software, Hardware, Zkušenosti a názory, Speciály

Pozoruhodné IT produkty 2024
E-knihy o IT zdarma
Manuál Linux
[Linux manuál]

assert: zrušte program, pokud je tvrzení nepravdivé

Originální popis anglicky: assert - abort the program if assertion is false

Návod, kniha: Linux Programmer's Manual

STRUČNĚ

#include <assert.h>
 
void assert(scalar expression);

POPIS / INSTRUKCE

If the macro NDEBUG was defined at the moment <assert.h> was last included, the macro assert() generates no code, and hence does nothing at all. Otherwise, the macro assert() prints an error message to standard output and terminates the program by calling abort() if expression is false (i.e., compares equal to zero).
The purpose of this macro is to help the programmer find bugs in his program. The message "assertion failed in file foo.c, function do_bar(), line 1287" is of no help at all to a user.

NÁVRATOVÁ HODNOTA

No value is returned.

ODPOVÍDAJÍCÍ

ISO9899 (ANSI C). In the 1990 standard, expression is required to be of type int and undefined behavior results if it is not, but in the 1999 standard it may have any scalar type.

BUGS

assert() is implemented as a macro; if the expression tested has side-effects, program behaviour will be different depending on whether NDEBUG is defined. This may create Heisenbugs which go away when debugging is turned on.

SOUVISEJÍCÍ

abort(3), assert_perror(3), exit(3)
2002-08-25 C99
©2011-2024 BusinessIT.cz, ISSN 1805-0522 | Názvy použité v textech mohou být ochrannými známkami příslušných vlastníků.
Provozovatel: Bispiral, s.r.o., kontakt: BusinessIT(at)Bispiral.com | Inzerce: Best Online Media, s.r.o., zuzana@online-media.cz
O vydavateli | Pravidla webu BusinessIT.cz a ochrana soukromí | Používáme účetní program Money S3 | pg(9140)