c++boostcompiler-warningsstatic-analysisboost-format

Compile-time checking of Boost.Format


Both Clang and GCC can check printf-style functions for mismatches between their format strings and their arguments. For example, they'll complain about statements like this:

printf("Hello, %s!\n");

Does anything similar exist for Boost.Format? In other words, are there any compiler switches, static analysis tools, etc. that can warn about code like

std::string s1 = str(boost::format("Hello, %s!"));

or

std::string s2 = str(boost::format("Hello, %s!") % "John" % "Doe");

Solution

  • Looks like it is not supported A ticket has been created on boost as well to track it. You may want to pick up trunk version if you really need it.

    https://svn.boost.org/trac/boost/ticket/6815