You could/should combine them together in a lot of case. you could then stripe the informtion if you need.
【在 c****n 的大作中提到】 : sure, never combine "-g" with "-O*". : : that's how it optimized your code.
c*n
4 楼
can I ask you when you should have to combine them?
【在 e****m 的大作中提到】 : You could/should combine them together in a lot of case. : you could then stripe the informtion if you need.
a*e
5 楼
when you need to make sure the compiler works correctly when these two options are used together. LOL.
【在 c****n 的大作中提到】 : can I ask you when you should have to combine them?
c*r
6 楼
when you are using GNU CC and want to debug optimized programs.
【在 c****n 的大作中提到】 : can I ask you when you should have to combine them?
c*r
7 楼
Read the gcc manual: "Unlike most other C compilers, GCC allows you to use -g with -O. The shortcuts taken by optimized code may occasionally produce sur- prising results: some variables you declared may not exist at all; flow of control may briefly move where you did not expect it; some statements may not be executed because they compute constant results or their values were already at hand; some statements may execute in different places because they were moved out of loops."
looks weird, it's surely that one can combine two options together and get no error. but what's the benefit from this combination? Do we really need to dubug a optimized code???
【在 c*r 的大作中提到】 : : Read the gcc manual: : "Unlike most other C compilers, GCC allows you to use -g with -O. : The shortcuts taken by optimized code may occasionally produce sur- : prising results: some variables you declared may not exist at all; : flow of control may briefly move where you did not expect it; some : statements may not be executed because they compute constant : results or their values were already at hand; some statements may : execute in different places because they were moved out of loops."