Why does this code get through the compiler without a return statement?
-
This must be a real newbie question.
I have this method declaration in the header (dbaccess.h):
@static QStringList indexProperties();@and this definition in dbaccess.cpp:
@QStringList DBAccess::indexProperties()
{
}@ie I've failed to provide return a value. I've just spent ages attempting to debug the problem, before spotting the obvious. Why doesn't the compiler pick up the missing return?
-
Obviously depends on the compiler... With gcc, don't forget to set -Wall
VS2008 does it out of the box -
[quote author="Franzk" date="1293004949"][quote author="florent.revelut" date="1292946918"]VS2008 does it out of the box[/quote] Depends on your warning level just like with gcc, if I recall correctly.
[/quote]
Hi,
In MSVS it's an error not a warning. I always use default levels: Warning level 3, no warning --> error translation. The MS compilers throw errors for such constructs.