Check if C ++ 11 features are in use or not

So, at the moment, my task is to check if there are any C ++ 11 dependencies and functions in the general code. The question is, is it possible to check if there are any?

Everything I can imagine can now be divided into two groups:

  • -std=c++11 -Wc++98-compat

    + parsing the output;

  • Boost.Config + many macros around all the code that seems more complicated than the first one,

Perhaps some static analyzers might have built-in functions?

I am building it on multiplatform so I can test on either windows or linux.

+3


source to share


1 answer


Cancellation of my comment.

Modern compilers have a -std=c++11

default value . The old ones should make it clear that we want C ++ 11 -std=c++11

. You can specify any standard you want. So using is -std=c++03

giving you error in all C ++ 11 constructs.



But that's not the whole story. Some code may behave differently in C ++ 03 and C ++ 11, but still compile! For example, static initialization is only thread safe in C ++ 11, so in C ++ 03 you get code that will compile but listen. Make sure you need to review all the code with someone who knows C ++ 03, C ++ 11 and their differences perfectly.

Perhaps you can keep this work going with static code analysis tools, but 100% sure you need to review it ...

+7


source







All Articles