Sign in Join

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

Mailing lists / fpc-devel / 2014-02

error in docs ?

9 messages · 5 people ·

Reply by email Subscribe to this list Your subscription

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

Martin Frb
to Martin Frb
Martin Frb wrote 14 lines
http://www.freepascal.org/docs-html/prog/progsu58.html#x64-630001.1.58 > Example: > > {$OPTIMIZATION ON} > > is equivalent to > > {$OPTIMIZATION 2} "2" is not in the list of supported keywords. And at least {$OPTIMIZATION 1} gives an compile error
{$OPTIMIZATION 2}  gives an error
but
{$OPTIMIZATION -usemachspeed}
Note the "-", fpc accepts everithing, if there is a dash, why.

Also, it appears one can only enable options, Or go down to a lower level? But not selectively switch an opt off?

Reply by email

Mark Morgan Lloyd
to Martin Frb
Martin Frb wrote 24 lines
On 06/02/2014 17:48, Martin Frb wrote: > http://www.freepascal.org/docs-html/prog/progsu58.html#x64-630001.1.58 > >> Example: >> >> {$OPTIMIZATION ON} >> >> is equivalent to >> >> {$OPTIMIZATION 2} > > "2" is not in the list of supported keywords. > > And at least {$OPTIMIZATION 1} gives an compile error > {$OPTIMIZATION 2} gives an error but {$OPTIMIZATION -usemachspeed} Note the "-", fpc accepts everithing, if there is a dash, why. Also, it appears one can only enable options, Or go down to a lower level? But not selectively switch an opt off?

Related question: can {$ifopt return any information about optimisation level? (Rationale: the other day I was trying to code some extremely rough fudge factors so that a program could throttle its performance depending on CPU type etc.).

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Sven Barth
to Martin Frb: http://www.freepascal.org/docs-html/prog/progsu58.html#x64-630001.1.58 "2" is not in the…
Martin Frb wrote 13 lines
http://www.freepascal.org/docs-html/prog/progsu58.html#x64-630001.1.58 > Example: > > {$OPTIMIZATION ON} > > is equivalent to > > {$OPTIMIZATION 2} "2" is not in the list of supported keywords. And at least {$OPTIMIZATION 1} gives an compile error

It should be {$OPTIMIZATION LEVEL2} instead (and {$OPTIMIZATION LEVEL1})

Regards,
Sven

Reply by email

Sven Barth
to Martin Frb: {$OPTIMIZATION 2} gives an error but {$OPTIMIZATION -usemachspeed} Note the "-", fpc…
Martin Frb wrote 21 lines
On 06/02/2014 17:48, Martin Frb wrote: > http://www.freepascal.org/docs-html/prog/progsu58.html#x64-630001.1.58 > >> Example: >> >> {$OPTIMIZATION ON} >> >> is equivalent to >> >> {$OPTIMIZATION 2} > > "2" is not in the list of supported keywords. > > And at least {$OPTIMIZATION 1} gives an compile error > {$OPTIMIZATION 2} gives an error but {$OPTIMIZATION -usemachspeed} Note the "-", fpc accepts everithing, if there is a dash, why.

I wonder why as well as the code should check for this....

Also, it appears one can only enable options, Or go down to a lower level? But not selectively switch an opt off?

You need to apply the same logic as for the -Oo option:

{$OPTIMIZATION LOOPUNROLL,NOPEEPHOLE}
{$OPTIMIZATION NOLOOPUNROLL,ASMCSE}

Regards,
Sven

Reply by email

Sven Barth
to Mattias Gaertner
Mattias Gaertner wrote 10 lines
On Thu, 06 Feb 2014 17:53:35 +0000 Martin Frb wrote: > On 06/02/2014 17:48, Martin Frb wrote: > [...] > {$OPTIMIZATION -usemachspeed} > Note the "-", fpc accepts everithing, if there is a dash, why. - is off. Everything behind is a comment.

Looking at the code parsing the option string I would say no... at least in 2.7.1.

Regards,
Sven

Reply by email

Mattias Gaertner
to Sven Barth
Show quoted text 6 lines
[...] >> {$OPTIMIZATION -usemachspeed} >> Note the "-", fpc accepts everithing, if there is a dash, why. > > - is off. > Everything behind is a comment.

The flag directives like H, I, R, RangeChecks work like this.

Looking at the code parsing the option string I would say no... at least in 2.7.1.

An exception that proves the rule. ;)

Mattias

Reply by email