NO

Author Topic: #pragma question  (Read 1677 times)

Offline John Z

  • Member
  • *
  • Posts: 796
#pragma question
« on: June 26, 2020, 03:28:00 PM »
There are three #pragma optimize choices - optimize( [ { time | size | none } ] ) but there are 5 optimize choices in the project configuration.  I'm just starting to use the #pragma option to selectively optimize and not optimize modules.  My question is when using #pragma optimize(time) is that resulting in /Ot or /O2?   Likewise for time is it resulting in /Os or /O1?

Is "end of the translation unit." meaning end of the specific module (like file.c?) where the #pragma is placed?

Thanks in advance for help,

John


Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: #pragma question
« Reply #1 on: June 28, 2020, 04:24:27 PM »
There are three #pragma optimize choices - optimize( [ { time | size | none } ] ) but there are 5 optimize choices in the project configuration.  I'm just starting to use the #pragma option to selectively optimize and not optimize modules.  My question is when using #pragma optimize(time) is that resulting in /Ot or /O2?   Likewise for time is it resulting in /Os or /O1?
/O1 is /Os, /O2 is /Ot.
What makes it five choices is "optimize more", which is /Ox. No #pragma for this option. The meaning of /Ox has shifted over the years, but right now it stands for "optimizations that can/will take longer to run, and only time will tell how generally useful they are". The meaning of /Ox could change again.

Is "end of the translation unit." meaning end of the specific module (like file.c?) where the #pragma is placed?
It means end of a preprocessed source file.

I'm just starting to use the #pragma option to selectively optimize and not optimize modules.
Why?!
/Pelle

Offline John Z

  • Member
  • *
  • Posts: 796
Re: #pragma question
« Reply #2 on: June 29, 2020, 12:39:55 AM »
First Pelle - Thank you very much for answering, I know you are busy with RC2 so I appreciate that you are answering this question.

/O1 is /Os, /O2 is /Ot.
What makes it five choices is "optimize more", which is /Ox. No #pragma for this option. The meaning of /Ox has shifted over the years, but right now it stands for "optimizations that can/will take longer to run, and only time will tell how generally useful they are". The meaning of /Ox could change again.
In reading the help file I made a false conclusion that /Os and /Ot were optimize and /O1 and /O2 were for 'optimize more' respectively.

Is "end of the translation unit." meaning end of the specific module (like file.c?) where the #pragma is placed?
It means end of a preprocessed source file.
Got it -

I'm just starting to use the #pragma option to selectively optimize and not optimize modules.
Why?!
I turned on global "optimize speed more" in version 9 and all was well.  Faster and smaller code resulted. I installed V10 on another machine and copied over the source directory.  Under version 10 it compiles and runs mostly but one program operation now fails.  When I set optimize to none in that source file the program operation works as before.  Basically I'm using local optimization to help troubleshoot.  I am trying to determine where and what in my code is causing the issue.

Thanks again for your help and time,

Best Regards,
John Z