Re: Stupid Compiler Tricks

From: James Turner (turnerjh@XTN.NET)
Date: 05/19/98


Sammy <samedi@DHC.NET> writes:

> > Try removing your compiler optimization flags. One optimization
> > technique is to combine two variables that are not used at the
> > same time into one location - this makes data needs smaller and
> > makes your code harder to debug. Perhaps this is what you're
> > running up against.
>
> That's what it turned out to be.  A simple -O flag resulted in several
> hours of frustration, but on the bright side, I guess it was saving me 4
> whole bytes of memory!
>
> > Debugging optimized code can be an interesting experience.
>
> Apparently.

Downside of not using -O is that gcc can't follow data.  Basically it
won't warn for possible use of uninitialized data plus a few other
things I believe.  Turning it on can help with compile-time warnings
at the cost of debugging.  Sometimes it's useful to have it on,
other times not.

--
James Turner               turnerjh@xtn.net
                           http://www.vuse.vanderbilt.edu/~turnerjh/


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST