Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2014-01

programmers guide 2.6 issue

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

John Lee

In Pascal programmers guide v2.6 Feb 2013 it explains how to use {$I ... } to include compiler information eg version string, time string etc so one can include eg in a writeln, but it does not mention not the optimisation level at which program was compiled.

Is this an omission or is this info elsewhere? If so where 7 how do I do it please?

TIA

John

Reply by email

Pierre Free Pascal
to John Lee

Hi John,

in the scanner.pas unit
procedure dir_include,
code starting around line 2324 on current trunk,
you can see that there are only a few special
names allowed.
If there is no match, the compiler looks for
an environment string with that name.

This might be the solution for your problem...

Otherwise you can try to submit a patch
adding such an option.

Pierre

Show quoted text 18 lines
-----Message d'origine----- De : [mailto:fpc-devel- De la part de John Lee Envoyé : mercredi 8 janvier 2014 14:21 À : FPC developers' list Objet : [fpc-devel] programmers guide 2.6 issue In Pascal programmers guide v2.6 Feb 2013 it explains how to use {$I ... } to include compiler information eg version string, time string etc so one can include eg in a  writeln, but it does not mention not the optimisation level at which program was compiled. Is this an omission or is this info elsewhere? If so where 7 how do I do it please? TIA John

Reply by email

John Lee

Thanks - I'd thought that I'd seen somewhere (here?) that one could get the opt info into compiler string somehow & thought it'd be there hence so doc . Maybe it is somewhere else & not under {I ...}?

Pierre Free Pascal wrote 38 lines
Hi John, in the scanner.pas unit procedure dir_include, code starting around line 2324 on current trunk, you can see that there are only a few special names allowed. If there is no match, the compiler looks for an environment string with that name. This might be the solution for your problem... Otherwise you can try to submit a patch adding such an option. Pierre > -----Message d'origine----- > De : [mailto:fpc-devel- > De la part de John Lee > Envoyé : mercredi 8 janvier 2014 14:21 > À : FPC developers' list > Objet : [fpc-devel] programmers guide 2.6 issue > > In Pascal programmers guide v2.6 Feb 2013 it explains how to use {$I > ... } to include compiler information eg version string, time string > etc so one can include eg in a writeln, but it does not mention not > the optimisation level at which program was compiled. > > Is this an omission or is this info elsewhere? If so where 7 how do I > do it please? > > TIA > > John

Reply by email

Sven Barth
to John Lee: In Pascal programmers guide v2.6 Feb 2013 it explains how to use {$I ... } to include…
"John Lee" wrote
In Pascal programmers guide v2.6 Feb 2013 it explains how to use {$I ...

} to include compiler information eg version string, time string etc so one can include eg in a writeln, but it does not mention not the optimisation level at which program was compiled.

Is this an omission or is this info elsewhere? If so where 7 how do I do

it please?

The optimizations are local not global, so it wouldn't make much sense to include such a functionality as they would only show you the currently active optimizations.

Regards,
Sven

Reply by email

John Lee
to Sven Barth

You are making it sound v complicated - but the settings eg for the main program eg might be -O3 or -O2 or something are meaningful - most people don't mess with them anyway. I feel sure that I've seen somewhere how to get them into compiler string, but can't remember how!

J

Sven Barth wrote 23 lines
Am 08.01.2014 14:21 schrieb "John Lee" : > > In Pascal programmers guide v2.6 Feb 2013 it explains how to use {$I ... } to include compiler information eg version string, time string etc so one can include eg in a writeln, but it does not mention not the optimisation level at which program was compiled. > > Is this an omission or is this info elsewhere? If so where 7 how do I do it please? The optimizations are local not global, so it wouldn't make much sense to include such a functionality as they would only show you the currently active optimizations. Regards, Sven _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Sven Barth
to John Lee
"John Lee" wrote
You are making it sound v complicated - but the settings eg for the main

program eg might be -O3 or -O2 or something are meaningful - most people don't mess with them anyway. I feel sure that I've seen somewhere how to get them into compiler string, but can't remember how!

This would then only work plausably if the function which uses that optimization to string functionality is defined inside the main program as each unit can be compiled differently. Also -O2, etc. are not the only optimization parameters: every specific optimization can be switched on and off independently of the optimization level and then there's also the "whole program optimization". So you see that this is not trivial.

Regards,
Sven

Reply by email

Marco van de Voort
to John Lee: You are making it sound v complicated - but the settings eg for the main program eg might…

In our previous episode, John Lee said:

You are making it sound v complicated - but the settings eg for the main program eg might be -O3 or -O2 or something are meaningful - most people don't mess with them anyway. I feel sure that I've seen somewhere how to get them into compiler string, but can't remember how!

Actually, it is worse for "most people" since they often use precompiled installs (and -units), The same for .e.g Lazarus packages that also have own compiler option settings.

Reply by email