AnsweredAssumed Answered

Is there any way to temp switch off dead code elimination via #pragma?

Question asked by Xiaouxe Yu on Mar 6, 2007
Latest reply on Mar 6, 2007 by Nouchi
I'm using HCS12, and for some reason I need to put a bunch of global variables into the CONST_SEG, hence I define them as "const". Those variables are actually referred via API functions, hence within the project they are only assigned with initial values. But I don't want the CodeWarrior to eleminate them during optimization, so I declare them as "extern" in some header file, or define them as "volatile". But this looks not quite good actually, for the modification of these variables are via some hardware path, not the normally way of global variable usage. So I wanna try use some #pragma to switch off the code optimization only on these variables. Is it possible? If so, which #pragma shall I use then?

Outcomes