3 ms·
gcc have -Og which turns on optimization steps that can be enabled without sacrificing debugability.
by andoma 6y ago
gcc have -Og which turns on optimization steps that can be enabled without sacrificing debugability.
- slavik81 6y agoIn practice, I find I usually have to switch to -O0, as nearly all my variables are <optimized out> with -Og.
- pm215 6y agoThat's been my experience too. Unfortunately the gcc devs essentially poisoned their own well there -- I'm now much less likely to want to go back and try -Og because of my initial bad experience. If they'd started with "always good debug and very few optimisations" and only added in optimisations when they didn't break the debug illusion then the user-experience would have been much better (always at least as good as -O0 when debugging, and gradually gets faster as you use newer gcc versions).