[fpc-pascal] FPC linter tool
Hi all, I am looking for an open source linter tool to use on FPC projects. A quick google search didn't yield anything specific. Hoping someone here can help me further. TIA Darius Verstuurd vanaf mijn iPhone ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] procedure and function parameters?
Am 04.03.2018 um 18:45 schrieb Sven Barth via fpc-pascal: On 04.03.2018 18:06, Bernd Oppolzer wrote: 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 ; There is only one solution that currently really will work with that kind of code: use {$mode iso} at the top of the file to use the ISO Pascal compatible mode. In theory it should also be possible to use another mode plus {$modeswitch nestedprocvars}, but that doesn't play nicely with the call to A inside of B as the compiler seems to call the X4 parameter while it shouldn't... Regards, Sven Thanks, mode iso worked without problems; the results were as expected. Kind regards Bernd ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] procedure and function parameters?
In our previous episode, Bernd Oppolzer said: > > function A ( K : INTEGER ; function X1 : INTEGER ; function X2 : > ?? INTEGER ; function X3 : INTEGER ; function X4 : INTEGER ; > ?? function X5 : INTEGER ) : INTEGER ; This is not valid in a Borland derived dialect. Use mode ISO (-Miso, I didn't try myself). ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] procedure and function parameters?
On 04.03.2018 18:06, Bernd Oppolzer wrote: > 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 ; There is only one solution that currently really will work with that kind of code: use {$mode iso} at the top of the file to use the ISO Pascal compatible mode. In theory it should also be possible to use another mode plus {$modeswitch nestedprocvars}, but that doesn't play nicely with the call to A inside of B as the compiler seems to call the X4 parameter while it shouldn't... Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] procedure and function parameters?
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 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] -CR Command line switch and Firebird.pas
Many thanks - not the most obvious of switch names - but it works. On 04/03/18 14:41, Jonas Maebe wrote: On 04/03/18 15:38, Tony Whyman wrote: Is there anyway of turning off the command line switch -CR (Verify object method call validity) on a per unit basis in the same way that -Cr (range checking) can be turned off using {$R-}? I can't see any such directive in the FPC documentation. {$OBJECTCHECKS off} Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] -CR Command line switch and Firebird.pas
On 04/03/18 15:38, Tony Whyman wrote: Is there anyway of turning off the command line switch -CR (Verify object method call validity) on a per unit basis in the same way that -Cr (range checking) can be turned off using {$R-}? I can't see any such directive in the FPC documentation. {$OBJECTCHECKS off} Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal