BIV BIV - 1 year ago 91
C++ Question

force c++ compiler to check returning value

In this example will be called deconstructor of nonexisting object. G++ version 5.3, compiling with -Werror .

vector<vector<float>> segfault()


int main()
return 0;

Answer Source

Both gcc and clang have the option -Wreturn-type.
It is turned on implicitly when using -Wall.
To make ensue it is a compiler error, use -Werror=return-type.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download