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 post
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 post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...