I think it is not caused by the setting of Xcode. In foo(), if a=1, it only coverge half code of the program, thus, its coverage is 50%. Actually, if a= -1, another half code is covered. If i can run program two times with a=1 and a =-1, make the code coveraged logic "and", that is the real coverage rate.
YQ
CC: email@hidden From: email@hidden To: email@hidden Subject: Re: Question about gcov in Xcode Date: Wed, 27 Aug 2008 15:06:05 -0700
Hi!
I've never used gcov, but as a shot in the dark, its man page says that gcov requires all compiler optimization to be off for it to function properly. Do you have all optimizations turned off?
Cheers, Andrew
On Aug 27, 2008,
at 2:40 PM, Yongqiang wrote: Hi,
I know how to set Xcode to use gcov. My question is if one program like this:
foo() { if (a>0) {a = 1;} else {a =0;} }
If use gcov, the coverage is 50%. Actually, its coveage should be 100%. How can i use gcov in Xcode to get the correct result?
YQ
Windows Live Writer,支持离线撰写博客内容,随时随地想写就写。
|