Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Mistake in docs. "Qt Coding Conventions" section
OLLO last edited by
It's not in one place, "Qt Coding Conventions":http://qt-project.org/wiki/Coding-Conventions , but others("example":http://qt.gitorious.org/qt-creator/qt-creator/blobs/8a2aab79e9db6a6bf0c179e8e84a812d0c1b62c1/doc/api/coding-style.qdoc) seems just copy of that.
In the end
@Always check whether a preprocessor variable is defined before probing its value (-Wundef)
#if Foo == 0 // W R O N G *first* #if defined(Foo) && Foo == 0 // Right *second* #if Foo - 0 == 0 // Clever, are we? Use the one above instead, for better readability *third*@
But if Foo is undefined second is false and third is true, because all undefined identifiers are replaced with literal 0. I checked this will latest Qt Creator and it act so.