abort.c

来自「一组基础的C库的实现」· C语言 代码 · 共 45 行

C
45
字号
/* $Id: abort.c 262 2006-11-16 07:34:57Z solar $ *//* Release $Name$ *//* abort( void )   This file is part of the Public Domain C Library (PDCLib).   Permission is granted to use, modify, and / or redistribute at will.*/#include <stdlib.h>#include <signal.h>#ifndef REGTESTvoid abort( void ){    raise( SIGABRT );    exit( EXIT_FAILURE );}#endif#ifdef TEST#include <_PDCLIB_test.h>#include <stdio.h>static void aborthandler( int signal ){    exit( 0 );}int main(){    int UNEXPECTED_RETURN_FROM_ABORT = 0;    BEGIN_TESTS;    TESTCASE( signal( SIGABRT, &aborthandler ) != SIG_ERR );    abort();    TESTCASE( UNEXPECTED_RETURN_FROM_ABORT );    return TEST_RESULTS;}#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?