Thread: string operation and related exception

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by George2 View Post
    I am wondering how assert is implemented internally? Using some soft interrupt or through by exception handling approach?
    something like
    Code:
    #undef  assert
    
    #ifdef  NDEBUG
    
    #define assert(exp)     ((void)0)
    
    #else
    
    #ifdef  __cplusplus
    extern "C" {
    #endif
    
    _CRTIMP void __cdecl _assert(void *, void *, unsigned);
    
    #ifdef  __cplusplus
    }
    #endif
    
    #define assert(exp) (void)( (exp) || (_assert(#exp, __FILE__, __LINE__), 0) )
    
    #endif  /* NDEBUG */
    <removed copyrighted code, sorry - CornedBee>

    So it is just an __crtMessageBoxA call followed by _DbgBreak to start debugging
    Last edited by CornedBee; 03-02-2008 at 07:04 AM.
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. Looking for examples for string related programs
    By koloth in forum C Programming
    Replies: 5
    Last Post: 04-14-2003, 11:57 PM