Forum > General

optimization switches not working?

(1/5) > >>

Selfmade.exe:
Hello,

Unless I miss something here is what happens:

If I put some opimization switches in project-> project options-> compiler options-> custom options  they work fine.

But because I dont want them there, if I remove them from there and put them in the main program as {$OPTIMIZATION some opimization switches} they don't work.

In both cases, in the project-> project options-> compiler options-> compilation and linking, the optimization level is set to zero (in order to choose exactly what optimizations I need.)

When I put them in the custom options, the progam runs significantly faster.

marcov:
Switches in the source are local to the module (unit,program) they are in.

Switches in the project or to the commandline are global to all modules compiled with them active (IOW: force rebuild to have it take a global effect).

Selfmade.exe:
I use simple program (project -> new project-> simple pogram), and I put the switches in the very top of the single lpr file, before the program xxx; Is this still doesn't affect the whole program?

marcov:

--- Quote from: Selfmade.exe on June 14, 2018, 11:50:00 pm ---I use simple program (project -> new project-> simple pogram), and I put the switches in the very top of the single lpr file, before the program xxx; Is this still doesn't affect the whole program?

--- End quote ---

That still doesn't affect the whole program. Only the code in the .lpr. It has been that way since Turbo Pascal 4 in 1987 introduced units.

Selfmade.exe:
Ok then, thank you very much! That pretty much explains everything!

Navigation

[0] Message Index

[#] Next page

Go to full version