Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2026-03

Correct syntax for default param?

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin Frb

https://gitlab.com/freepascal.org/fpc/source/-/work_items/41642#note_3135425124

That's actually a FPC compiler bug: procedure WriteProperty(Path: String; Instance: TObject; PropInfo: Pointer; DefInstance: TObject = nil; const OnlyProperty: array of String);

then what is the correct syntax?

The link suggests there needs to be a default value for OnlyProperty (and I would have expected that too).

But FPC does reject *any* default. It reject the = sign itself, if any is added.

So what is the correct syntax?

Reply by email

Michael Van Canneyt
to Martin Frb
Martin Frb wrote 16 lines
https://gitlab.com/freepascal.org/fpc/source/-/work_items/41642#note_3135425124 > That's actually a FPC compiler bug: > procedure WriteProperty(Path: String; Instance: TObject; > PropInfo: Pointer; DefInstance: TObject = nil; > const OnlyProperty: array of String); then what is the correct syntax? The link suggests there needs to be a default value for OnlyProperty (and I would have expected that too). But FPC does reject *any* default. It reject the = sign itself, if any is added. So what is the correct syntax?

As I wrote in the ticket you refer to, it's a bug in FPC, which is formalized in this ticket:

https://gitlab.com/freepascal.org/fpc/source/-/work_items/41644

I would expect - when the bug is corrected - that the syntax is "= Nil"

For the time being, I suggest you use an overload.

Michael.

Reply by email