C language > Beginner questions

#pragma question

(1/1)

John Z:
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

Pelle:

--- Quote from: John Z 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?

--- End quote ---
/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.


--- Quote from: John Z on June 26, 2020, 03:28:00 PM ---Is "end of the translation unit." meaning end of the specific module (like file.c?) where the #pragma is placed?

--- End quote ---
It means end of a preprocessed source file.


--- Quote from: John Z on June 26, 2020, 03:28:00 PM ---I'm just starting to use the #pragma option to selectively optimize and not optimize modules.

--- End quote ---
Why?!

John Z:
First Pelle - Thank you very much for answering, I know you are busy with RC2 so I appreciate that you are answering this question.


--- Quote from: Pelle on June 28, 2020, 04:24:27 PM ---/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.
--- End quote ---
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.


--- Quote from: John Z on June 26, 2020, 03:28:00 PM ---Is "end of the translation unit." meaning end of the specific module (like file.c?) where the #pragma is placed?

--- End quote ---

--- Quote from: Pelle on June 28, 2020, 04:24:27 PM ---It means end of a preprocessed source file.
--- End quote ---
Got it -


--- Quote from: John Z on June 26, 2020, 03:28:00 PM ---I'm just starting to use the #pragma option to selectively optimize and not optimize modules.

--- End quote ---

--- Quote from: Pelle on June 28, 2020, 04:24:27 PM ---Why?!

--- End quote ---
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

Navigation

[0] Message Index

Go to full version