[fpc-pascal] Procedural parameters
Sven Barth
pascaldragon at googlemail.com
Sun Dec 15 19:09:11 CET 2024
Michael Van Canneyt via fpc-pascal <fpc-pascal at lists.freepascal.org>
schrieb am So., 15. Dez. 2024, 18:25:
>
>
> On Sun, 15 Dec 2024, Adriaan van Os via fpc-pascal wrote:
>
> > Michael Van Canneyt via fpc-pascal wrote:
> >>
> >>
> >> On Sat, 14 Dec 2024, Adriaan van Os via fpc-pascal wrote:
> >>
> >> It's not because something is in the pascal standard, that FPC has it.
> >
> > It is. Appendix D6 of the Programmer's Reference says
> >
> > "This mode is selected by the $MODE ISO switch. On the command
> line,
> > this mode is selected by
> > the -Miso switch. In this mode, the compiler complies with the
> requirements
> > of level 0 and level 1
> > of ISO/IEC 7185."
>
> Let's examine that statement for a second.
>
> In my copy of the standard, section "6.1.3 Identifiers" starts with:
> "Identifiers can be of any length."
>
> This is not implemented in FPC: identifiers are max 255 chars.
>
> Section "6.1.4 Directives" states:
> "The only directive shall be the required directive 'forward'"
>
> But you can also pefectly compile in ISO mode
>
> procedure a; cdecl; forward;
>
> One can use semantic tricks and say that 'cdecl' is a modifier,
> unfortunately then still the above violates the syntax diagram in section
> 6.6.2,
> which leaves no room for 'modifiers'.
>
> But either FPC follows the standard to the letter (that is why it is a
> standard), or
> it does not.
>
> Both examples show that in the strict sense, FPC does not follow the
> standard, even in ISO mode. Probably more examples can be found.
>
> For the quoted text to be painstakingly correct, the manual text should
> better be phrased as "The compiler tries to comply with..."
>
> The alternative is that we're a little more flexible in our interpretation
> of
> standards and manuals or messages on this list, and then we accept that
> there
> may be extra or missing things in either standard and/or implementation.
>
> Which I paraphrased loosely as:
> "It's not because something is in the pascal standard, that FPC has it."
>
As with any of the language dialect compatibility modes the point is that
FPC can compile code in that dialect, but *not* that code that compiles in
that dialect mode in FPC does also compile in another compiler that
supports that dialect.
For example FPC allows global generic functions in mode Delphi while Delphi
itself does not support them.
Regards,
Sven
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20241215/16316483/attachment.htm>
More information about the fpc-pascal
mailing list