g++ - is using the "-g" flag for production builds a good idea?
- by Grigory
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.