FreeBASIC  0.91.0
error_assert.c
Go to the documentation of this file.
1 /* assertion functions */
2 
3 #include "fb.h"
4 
5 FBCALL void fb_Assert( char *filename, int linenum, char *funcname, char *expression )
6 {
7  snprintf( __fb_errmsg, FB_ERRMSG_SIZE,
8  "%s(%d): assertion failed at %s: %s\n",
9  filename, linenum, funcname, expression );
10 
11  __fb_errmsg[FB_ERRMSG_SIZE-1] = '\0';
12 
13  /* Let fb_hRtExit() show the message */
15 
16  fb_End( 1 );
17 }
18 
19 FBCALL void fb_AssertWarn( char *filename, int linenum, char *funcname, char *expression )
20 {
21  /* Printing to stderr, as done with assert() or runtime error messages
22  in fb_hRtExit() */
23  fprintf( stderr, "%s(%d): assertion failed at %s: %s\n",
24  filename, linenum, funcname, expression );
25 }