On Fri, Sep 11, 2009 at 12:47 AM, D. Michael McIntyre <[email protected]> wrote: > They suspect the "NetBeans points at the wrong line" problem is related to > problems in general trying to debug optimized binaries. They suggest that it > is standard practice to use non-optimized binaries for debugging purposes.
It is. > What is the precedence of options in g++? Does the first -O2 take precedence > over the last -O1? Is this behavior even defined? And for that matter, > shouldn't this be -O0 to avoid optimizing for debugging purposes? Well, there are quite a few questions here. First, I've no clear idea where the -g -O2 combination comes from. Those might be reasonable flags for a "provisional release build", i.e. something you want to distribute with reasonable performance but permit people to get at least marginally useful stack traces from. They're not particularly useful for developers' own debug builds. For the best results debugging, you definitely do want -g -O0 (I think the latter is implied by -g if you have no other -O options present). There is a genuine reason why we use -O1 in the debug build, which is that certain compiler warnings are only available if you have a modest amount of optimisation enabled -- notably warnings about uninitialised variables -- presumably the compiler doesn't calculate the relevant facts if it isn't going to need them for optimisation. At the time I added that flag, I was clearly more interested in warnings than stack traces, but there's no reason it shouldn't be reverted to -O0. Finally, I _thought_ that later -O options in the command line overruled earlier ones, but I can't actually seem to find any reference for that at the moment and I haven't tested it, so I may be mistaken. I wouldn't particularly mind losing the ability to pick up CXXFLAGS from the environment myself. Chris ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Rosegarden-devel mailing list [email protected] - use the link below to unsubscribe https://lists.sourceforge.net/lists/listinfo/rosegarden-devel
