View Full Version : Compiler optimization question

10th December 2011, 22:47
Hi! First I wonder, is qmake a compiler or does it just create makefiles that it uses when compiling the code with another compiler, say gcc or mingw? My second question is, does qmake optimize multiplication/division by one? That is, if I write

a = one * b;

a = b * one;

a = b / one;
, is this optimized to just

a = b;
? Here, "one" is either a define or a const that is set to one. Also, does it depend on whether a and b are float types, and on whether one is a float type?

10th December 2011, 22:54
qmake is not a compiler. It just creates the make files (depending on the used mkspec it generates the make file for different compilers.)

If the code you have posted is optimized depends on your compiler. But you can make a simple program, compile it and see yourself in the assembler code.

10th December 2011, 23:15
How do I do that? My compiler should be mingw, since I have downloaded the mingw version of Qt Library and also Qt Creator.