Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ASSER - VERIFY [modified]

ASSER - VERIFY [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
questiondebuggingannouncement
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    big_denny_200
    wrote on last edited by
    #1

    Hello :) I have a question ? What is the advantage of writing ASSERT instead of VERIFYS ? As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds Correct me if I am wrong. Thank you PS. I have written VERIFY(0) in my program(OnInitDialog) and built in Release mode, but it did not halt my program ?? why :confused: -- modified at 5:59 Friday 2nd June, 2006

    S M N T 4 Replies Last reply
    0
    • B big_denny_200

      Hello :) I have a question ? What is the advantage of writing ASSERT instead of VERIFYS ? As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds Correct me if I am wrong. Thank you PS. I have written VERIFY(0) in my program(OnInitDialog) and built in Release mode, but it did not halt my program ?? why :confused: -- modified at 5:59 Friday 2nd June, 2006

      S Offline
      S Offline
      Sarath C
      wrote on last edited by
      #2

      big_denny_200 wrote:

      As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds

      the answer is there in your question. If u use VERIFY in ur project u may need to delete all assert statement which u have used for debuggin purpose. So if there is only debugging purpose, use ASSERT and if something "should not" occur in your program at any cost use VERIFY. SaRath.
      "Don't Do Different things... Do Things Differently..."

      1 Reply Last reply
      0
      • B big_denny_200

        Hello :) I have a question ? What is the advantage of writing ASSERT instead of VERIFYS ? As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds Correct me if I am wrong. Thank you PS. I have written VERIFY(0) in my program(OnInitDialog) and built in Release mode, but it did not halt my program ?? why :confused: -- modified at 5:59 Friday 2nd June, 2006

        M Offline
        M Offline
        Maxwell Chen
        wrote on last edited by
        #3

        big_denny_200 wrote:

        As far as I understood, there is no need of using ASSERT

        ASSERT or _assert is for developers to make sure there nothing wrong during the development. When he/she is sure that everything is just fine, he/she compiles it in release build. ASSERT is defined as "nothing" in release build.


        Maxwell Chen

        1 Reply Last reply
        0
        • B big_denny_200

          Hello :) I have a question ? What is the advantage of writing ASSERT instead of VERIFYS ? As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds Correct me if I am wrong. Thank you PS. I have written VERIFY(0) in my program(OnInitDialog) and built in Release mode, but it did not halt my program ?? why :confused: -- modified at 5:59 Friday 2nd June, 2006

          N Offline
          N Offline
          Nibu babu thomas
          wrote on last edited by
          #4

          In release versions ASSERT evaluates to nothing. This means the statements given inside ASSERT are not executed. This could be trouble sometimes when you write statements like...

          int i;
          ASSERT( (i=GetI()) != 0 );

          This statement won't execute in Release versions but will work fine in debug builds. In Release builds all statements depending on the value of 'i' will fail as the code expands to nothing. In such cases use VERIFY. Which executes in both versions. But will only show an alert box in the debug versions.

          int i;
          VERIFY( (i=GetI()) != 0 );


          Nibu thomas A Developer Programming tips[^]  My site[^]

          1 Reply Last reply
          0
          • B big_denny_200

            Hello :) I have a question ? What is the advantage of writing ASSERT instead of VERIFYS ? As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds Correct me if I am wrong. Thank you PS. I have written VERIFY(0) in my program(OnInitDialog) and built in Release mode, but it did not halt my program ?? why :confused: -- modified at 5:59 Friday 2nd June, 2006

            T Offline
            T Offline
            toxcct
            wrote on last edited by
            #5

            The Surviving the Release[^] article by Mr. Newcomer explains very well the difference and uses of ASSERT and VERIFY macros.


            TOXCCT >>> GEII power

            [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups