www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/21/23:22:37

To: "Hans-Bernhard Broeker" <broeker AT physik DOT rwth-aachen DOT de>
Date: Wed, 21 Oct 1998 21:20:09 -0700
From: "Doug Gale" <dgale AT mailexcite DOT com>
Message-ID: <JOAKAOMKMAMEAAAA@mailexcite.com>
Mime-Version: 1.0
Cc: djgpp AT delorie DOT com
X-Sent-Mail: on
X-Mailer: MailCity Service
Subject: Re: Profile suggestions
X-Sender-Ip: 207.136.101.69
Organization: MailExcite (http://www.mailexcite.com:80)
Reply-To: djgpp AT delorie DOT com

On Tue, 20 Oct 1998 16:45:37   Hans-Bernhard Broeker wrote:
>In article <362C28A9 DOT 4CD070DF AT mailexcite DOT com> you wrote:
>[...]
>
>> My opinion? Sure:
>> Developing code: -W -Wall -Wno-sign-compare -g -O0
>> -fno-omit-frame-pointer
>
>This is not a good idea, as '-O0' (i.e.: no optimization at all)
>*disables* quite a set of warnings you would normally get from
>'-Wall'. That's because in -O0 mode, gcc doesn't analyze the code in
>enough depth to even find these problematic cases. For *full* warning
>level, you need '-Wall -W -O'. 

Ok, you're right. Maybe I should have said it this way.

Writing code: -W -Wall -Wno-sign-compare -g -O
Stepping through code or hunting nasty bug: -W -Wall -Wno-sign-compare -g -O0

If you use -O0, it maximizes the possibility that you will be able to examine the value of any variable and get the current value. Unfortunately, the debugger (in RHIDE, at least) does not recognize the existence of register variables and cannot examine the value of a variable that has been optimized into a register. This can be frustrating when you have finally stepped into the area where a bug is, and you examine the variable (expecting to say GOTCHA), and you get some garbage value, or not the value that it *really* was at that moment. Then, (assuming you *really* think that is where the bug is) you have to force no optimization and force compile that source file, and relink, and step, and do all the crap to get back to that place in the source. I'd much rather disable optimization when chasing a bug and using the debugger, than leave it enabled so it can see uninitialized variables and other warnings.



Free web-based email, Forever, From anywhere!
http://www.mailexcite.com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019