CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 1999
    Location
    Miami, FL
    Posts
    972

    ASSERT vs. _ASSERT vs. _ASSERTE

    I've seen some code using the ASSERT macro and other code using the _ASSERT and _ASSERTE macros. Can anyone shed some light on what their difference are and which one(s) should be used?

    Thanks,
    Alvaro


  2. #2
    Join Date
    May 1999
    Posts
    667

    Re: ASSERT vs. _ASSERT vs. _ASSERTE

    ASSERT is an MFC macro, where as _ASSERT/_ASSERTE are defined in CRTDBG.H (C Runtime Library). _ASSERT is the same as ASSERT where as _ASSERTE will show the expression in the debug log.

    HTH,
    Chris


  3. #3
    Join Date
    Jun 1999
    Location
    Miami, FL
    Posts
    972

    Re: ASSERT vs. _ASSERT vs. _ASSERTE

    So do you recommend I always use _ASSERTE?


  4. #4
    Join Date
    May 1999
    Posts
    667

    Re: ASSERT vs. _ASSERT vs. _ASSERTE

    Using _ASSERTE generates more overhead for your Debug version because every expression in _ASSERTE needs to be stored in the exe as a string. I just use ASSERT from MFC and it gives you the file & line number which is enough information to find out where the problem is.

    HTH,
    Chris



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured