Forum OpenACS Q&A: Re: Do NOT compile nsxml with -O !

Collapse
Posted by Roberto Mello on
Interesting,

They do say that your program will have unpredictable results when being debugged though. So if you're not planning to debug it, it should be safe to just not put any optimizations in.

I'm making an educated guess here, but it should also be okay to compile AOLserver with -Ox and ns_xml without.

-Roberto

Collapse
Posted by Jeff Davis on
It's fine to mix different optimization levels and if that makes the problem go away thats nice. My experience though is that if behavior changes in a C program based on different optimization flags is almost always due to a memory bug; maybe someone can try running purify on aolserver/nsxml?

Anyway, I do -g -O2 on everything and have not had any problems either. As for debugging things compiled -g -O2, usually it's pretty easy to do. Your life is easier when you have debugable executables and with gcc allowing optimization together with debug symbols there aren't too many reasons not to always have the symbols.