C++ compile time purity checks?

c++

Solution

const-correctness and high compiler warning levels should do a lot of what you are asking for. Also specifying a very strict modern dialect of C++ for the compiler ( which can annoy the hell out of you, when you are using third-party libraries and code that dont comply )

If not, then there are a plethora of static analysis tools out there, some open source, some expensive like Coverity, Parasoft C++Test and so on.

Problem

Is it possible to specify compile time "purity" checks in C++? I.e.: ``` this function does not read from anything other than it's arguments this function does not write to anything; it only returns the return value ```

Original source