CS 105 (C++)

Discussion 14
C++: Other Things You Should Know

compiler flags

Here are a few compiler flags (arguments to g++) that we haven't covered (or not much) which are commonly used in the real world.

Do you know what they mean?

  1. -Wall

    Enables a number of warnings about potentially dangerous characteristics of the code being compiled.  This can often save you from the kinds of mistakes that, while not preventing compilation, nevertheless do things that are definitely not what you wanted.  

  2. -O3

    Activates optimization during compilation.  Multiple levels are available (-O0 through -O3 on last check of g++ man page).  The resulting code can be much faster without forcing the programmer to skimp on safe, easy-to-read coding style.  

  3. -g

    Produces debugging information to be used by debuggers like gdb.