g++ - is using the "-g" flag for production builds a good idea?

Posted by Grigory on Stack Overflow See other posts from Stack Overflow or by Grigory
Published on 2012-06-11T22:23:10Z Indexed on 2012/06/11 22:40 UTC
Read the original article Hit count: 256

Filed under:
|

Just to give some context, I'm talking about compiling C++ code with g++ here.

I can see how including the -g flag for production builds would be convenient for maintenance: the program will be much easier to debug if it crashes unexpectedly.

My question here is, does including the -g flag affect the output executable in any other way than increasing its size? Can it somehow make the code slower (e.g. by turning off certain optimizations)?

From what I understand, it shouldn't (the documentation only mentions the inclusion of debug symbols), but I'm not sure.

© Stack Overflow or respective owner

Related posts about c++

Related posts about g++