CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 4 of 4

Thread: Assert in debug mode

  1. #1
    Join Date
    May 2015

    Assert in debug mode


    I have the following defined:
    #define VERIFY(f)          ASSERT(f)
    And from somewhere :
    template <typename T>
    T FnData(const CommonD& data, bool (CommonD::*memberfunc)(T&) const)
      	T retVal;
    	VERIFY( (data.*memberfunc)(retVal) );
    	return retVal;
    And when i run, I can see the valid member function is getting called. But not sure why the ASSERT is getting hit and throws exception at redline.. Please kindly help

    thanks a lot

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004

    Re: Assert in debug mode

    Does the contents of VERIFY(f) evaluate to true or false?

    You're putting in

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012

    Re: Assert in debug mode


    VERIFY( (data.*memberfunc)(retVal) );

    VERIFY( (memberfunc)(data) );
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.8.2)

  4. #4
    Join Date
    May 2015

    Re: Assert in debug mode

    Thankyou Arjay and kaud.

    VERIFY( (data.*memberfunc)(retVal) ); was already there, part of legacy code.

    I was missing some initialisation, so verify was returning false. I corrected it. and it is ok now.

    Yes, VERIFY( (data.*memberfunc)(retVal) ); looks bit odd !!! ... But it is legacy code ...

Tags for this Thread

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)