c++ -O2 -o aec aec.cpp

This is a discussion on c++ -O2 -o aec aec.cpp within the C++ Programming forums, part of the General Programming Boards category; Please let me know what -O2 means? I can compile this file "http://read.pudn.com/downloads169/sourcecode/unix_linux/777160/aec/aec-test.c__.htm" but I dont really know what the ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    94

    c++ -O2 -o aec aec.cpp

    Please let me know what -O2 means? I can compile this file "http://read.pudn.com/downloads169/sourcecode/unix_linux/777160/aec/aec-test.c__.htm"
    but I dont really know what the heck means this -O2

    Thanks!

  2. #2
    Registered User
    Join Date
    Mar 2010
    Location
    China
    Posts
    74
    -O1 Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function.
    -O2 Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff. As compared to -O, this option increases both compilation time and the performance of the generated code.
    -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2 and also turns on the -finline-functions, -funswitch-loops, -fpredictive-commoning, -fgcse-after-reload and -ftree-vectorize options.
    -O0 Reduce compilation time and make debugging produce the expected results. This is the default.
    -Os Optimize for size. -Os enables all -O2 optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size.

    Copied from gcc's manual

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Buidl Library with ./configure script
    By Jardon in forum C Programming
    Replies: 6
    Last Post: 07-24-2009, 10:36 AM
  2. Problem with compiling code with option -O2
    By koushikyou in forum C Programming
    Replies: 16
    Last Post: 01-07-2009, 06:03 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21