[fpc-pascal] function const default argument

Santiago A. svaa at ciberpiula.net
Thu Aug 26 09:40:06 CEST 2021


Freepascal 3.2.0. Windows 7-32bits

I have these functions:

function F(const x:extended; const delta:extended=1E-8):extended;

function G(const x:extended; const delta:extended=1E-8):extended;

and I want to parametrize like this:

  DefaultDelta:extended = 1E-8;

function F(const x:extended; const delta:extended=DefaultDelta):extended;

function G(const x:extended; const delta:extended=DefaultDelta):extended;

But I get "Illegal expression" in the header function declaration.
Const parameters don't accept const expressions?

Santiago A.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210826/b51ea981/attachment.htm>

More information about the fpc-pascal mailing list