Results 1 to 3 of 3

Thread: Compiler optimization question

  1. #1
    Join Date
    Nov 2011
    Posts
    51
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Compiler optimization question

    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

    Qt Code:
    1. a = one * b;
    To copy to clipboard, switch view to plain text mode 
    or

    Qt Code:
    1. a = b * one;
    To copy to clipboard, switch view to plain text mode 
    or

    Qt Code:
    1. a = b / one;
    To copy to clipboard, switch view to plain text mode 
    , is this optimized to just

    Qt Code:
    1. a = b;
    To copy to clipboard, switch view to plain text mode 
    ? 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?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Compiler optimization question

    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.

  3. #3
    Join Date
    Nov 2011
    Posts
    51
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Compiler optimization question

    How do I do that? My compiler should be mingw, since I have downloaded the mingw version of Qt Library and also Qt Creator.

Similar Threads

  1. Qt Creator Parse compiler errors of a non gcc compiler
    By kiozen in forum Qt Tools
    Replies: 4
    Last Post: 4th July 2011, 02:34
  2. msvc Compiler or mingw compiler
    By Ashutosh2k1 in forum Qt Programming
    Replies: 3
    Last Post: 14th February 2011, 09:33
  3. Strange compiler behaviour (compiler passes wrong argument)
    By SasaVilic in forum General Programming
    Replies: 2
    Last Post: 2nd November 2010, 12:36
  4. Useless but curious compiler warning question
    By Raccoon29 in forum General Programming
    Replies: 4
    Last Post: 30th July 2008, 21:46
  5. Just in time compiler question
    By mickey in forum General Discussion
    Replies: 2
    Last Post: 17th July 2007, 00:08

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.