Sign in Join
Wiki copytemporary

FPC message: Wrong number of parameters specified: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: FPC message: Wrong number of parameters specified

OldNewLine
1+## Missing parameter or too many parameters
2+
3+You confused the function and forgot a parameter or added a parameter too much.
4+
5+## Missing `@`
6+
7+For example:
8+
9+``` pascal
10+Button1.Click := Button1Click;
11+```
12+
13+In [[Mode ObjFPC|{$mode objfpc}]] you must add the [[@|@-address-operator]] to tell the compiler, that you want the pointer to the function, not the result of the function:
14+
15+``` pascal
16+Button1.Click := @Button1Click;
17+```
18+
19+Delphi users often confuse this, because Delphi allows it and adds the @ internally. If you prefer the Delphi syntax you can use [[Mode Delphi|{$mode Delphi}]] instead of `{$mode ObjFPC}`, or use the [[sGlobalModeswitch|mode switch]] `{$modeswitch classicprocvars on}`.
20+
21+---
22+*From the Free Pascal wiki, page "FPC message: Wrong number of parameters specified", as it stood on 2020-02-16 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history