X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Message-ID: <3C9DB84E.5ED3B308@yahoo.com> From: CBFalconer Organization: Ched Research X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Breakpoints crazy? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 34 Date: Sun, 24 Mar 2002 12:38:22 GMT NNTP-Posting-Host: 12.90.170.45 X-Complaints-To: abuse AT worldnet DOT att DOT net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1016973502 12.90.170.45 (Sun, 24 Mar 2002 12:38:22 GMT) NNTP-Posting-Date: Sun, 24 Mar 2002 12:38:22 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > On Sat, 23 Mar 2002, CBFalconer wrote: > > > Probably because optimization has rearranged the code. Just turn > > it off (remove the -On compile flag, for whatever n you are using, > > probably 2). Put it back when you are satisfied. > > It's IMHO a bad idea to turn off optimizations when debugging a program. > Compilers these days do such complicated code changes when optimizing > that you are effectively debugging a very different program. So you > either need to debug the program twice, first without optimizations, then > with them (and who has the will power and resources to do that?), or use > untested program when you turn on optimizations for production version. True enough, but you are usually debugging your own logical errors rather than performance issues (or compiler optimizer bugs). With things optimized simply debugging the assembly code generated will usually keep everything straight. With me such step by step debugging is a last resort anyhow. A mild sprinkling of asserts and printfs is usually much more productive. At any rate I think we are agreed that the OP has been confused by the optimization. -- Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT XXXXworldnet DOT att DOT net) Available for consulting/temporary embedded and systems. (Remove "XXXX" from reply address. yahoo works unmodified) mailto:uce AT ftc DOT gov (for spambots to harvest)