Don't optimize a block of code?

Discussion in 'iOS Programming' started by martay, Jan 17, 2009.

  1. martay macrumors newbie

    Oct 1, 2008
    Is there a way to tell the compiler not to optimize a block of code? Something like this would be nice:

    #pragma dont_optimize

    ... code ...

    #pragma do_optimize

    I'm having an opengles problem that only occurs in release mode, not in debug, and I'd like to narrow it down.
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    You can set compiler settings on a per file basis, that's it. You'll have to look up the compiler switches that affect optimization, although -O0 should turn off most or all optimizations.
  3. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    If it's one function or method, just move it to a different file. Then you can give that one file a custom build setting that should override the project setting default.


Share This Page