[fpc-pascal] procedure and function parameters?

Bernd Oppolzer bernd.oppolzer at t-online.de
Sun Mar 4 18:06:42 CET 2018


Are procedure and function parameters allowed in Free Pascal?

When I tried to compile the Man-or-boy example program (Knuth's test),
FPC complained with a syntax error:


c:\work\pascal\work>fpc manorboy.pas
Free Pascal Compiler version 3.0.0 [2015/11/16] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling manorboy.pas
manorboy.pas(41,28) Fatal: Syntax error, "identifier" expected but 
"FUNCTION" found
Fatal: Compilation aborted
Error: C:\FPC\3.0.0\bin\i386-win32\ppc386.exe returned an error exitcode


This is the place where the function parameter appears in the
definition of the function A:


function A ( K : INTEGER ; function X1 : INTEGER ; function X2 :
            INTEGER ; function X3 : INTEGER ; function X4 : INTEGER ;
            function X5 : INTEGER ) : INTEGER ;


    function B : INTEGER ;

       begin (* B *)
         K := K - 1 ;
         B := A ( K , B , X1 , X2 , X3 , X4 ) ;
       end (* B *) ;


    begin (* A *)
      if K <= 0 then
        begin
          A := X4 + X5 ;
        end (* then *)
      else
        begin
          A := B ;
        end (* else *) ;
    end (* A *) ;

Thank you, kind regards

Bernd





More information about the fpc-pascal mailing list