abrt_hnd.gml

来自「开放源码的编译器open watcom 1.6.0版的源代码」· GML 代码 · 共 56 行

GML
56
字号
.func abort_handler_s
#define __STDC_WANT_LIB_EXT1__ 1
#include <stdlib.h>
void abort_handler_s(
        const char * restrict msg,
        void * restrict ptr, 
        errno_t error );
.ixfunc2 '&Process' &func
.funcend
.*
.desc begin
The &func function may be passed as an argument to the
.mono set_constraint_handler_s
function. It writes a message on the standard error stream in the
following format:

.millust begin
Runtime-constraint violation: <msg>
.millust end
.np
The &func function then calls the
.mono abort
function.
.desc end
.*
.return begin
The &func function does not return to its caller.
.return end
.*
.see begin
.seelist abort_handler_s ignore_handler_s set_constraint_handler_s
.see end
.*
.exmp begin
#define __STDC_WANT_LIB_EXT1__ 1
#include <stdlib.h>
#include <stdio.h>
.exmp break
void main( void )
{
    constraint_handler_t    old_handler;
.exmp break
    old_handler = set_constraint_handler_s( abort_handler_s );
    if( getenv_s( NULL, NULL, 0, NULL ) ) {
        printf( "getenv_s failed\n" );
    }
    set_constraint_handler_s( old_handler );
}
.exmp output
Runtime-constraint violation: getenv_s, name == NULL.
ABNORMAL TERMINATION
.exmp end
.*
.class TR 24731
.system

⌨️ 快捷键说明

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