[fpc-pascal] function const default argument
Santi
svaa at ciberpiula.net
Thu Aug 26 10:47:27 CEST 2021
El 26/08/2021 a las 10:00, Ondrej Pokorny via fpc-pascal escribió:
> On 26.08.2021 09:40, Santiago A. via fpc-pascal wrote:
>> const
>> 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?
>
> You need:
>
> const
> DefaultDelta = 1E-8;
>
Thanks, it works fine.
But I can't see why specifying the type doesn't work;
>
> function F(const x:extended; const delta:extended=DefaultDelta):extended;
>
> Ondrej
>
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
--
Saludos
Santi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210826/be983459/attachment.htm>
More information about the fpc-pascal
mailing list