Jump to content

disbale sc_assert statements


Recommended Posts

Yes, defining NDEBUG also disables the sc_assert statements in the SystemC proof-of-concept implementation.

 

Having said that, I don't think it is a good idea to do so globally.  You usually want your simulation to reliably abort in case of an error/bug, instead of running into arbitrary undefined behaviour.

 

I would recommend to leave assertions active by default until profiling proves that (specific) assertions have a significant performance impact.  In such cases, selectively disable only these assertions in optimized configurations.

 

/Philipp

Link to comment
Share on other sites

Hello Philipp

 

With following example, where I have #define NDEBUG, the sc_assert is still executed.

#include "systemc.h"
#define NDEBUG

SC_MODULE(trial){
    public:
    int i;
    SC_HAS_PROCESS(trial);
    trial(sc_module_name name){
        i=10;
        sc_assert(i!=10);
    }
};

int sc_main(int , char**){
    trial et("et");
    sc_start();
    return 0;
}

 

 

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...