Fix Polyspace Compilation Errors About Namespace std
Without
Prefix
Issue
The Polyspace® analysis stops with an error message such as:
error: the global scope has no "modfl"
std::
prefix.Cause
Some compilers allow using members of the standard library namespace without
explicitly specifying the std::
prefix. For such compilers, your code
can contain lines like this:
using ::mblen;
mblen
is a member of the C++ standard library. Polyspace compilation considers the members as part of the global namespace and
shows an error.Solution
It is a good practice to qualify members of the standard library with the
std::
prefix. For instance, to use the mblen
function in the preceding example, rewrite the line
as:
using std::mblen;
To continue to retain the current code and work around the Polyspace error, use the analysis option -using-std
. If you are
running the analysis in the Polyspace user interface, enter the option in the Other field.
See Other
.