Sign in Join

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

Mailing lists / fpc-pascal / 2013-03

EmptyStr

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Ernest V Miller

Hello!

Why assigning EmptyStr as default value in signature is not allowed while using it in body is OK?
Using fpc 2.6.0

function GroupThread.applyReflectRules(currIndex : integer; out skip :
Boolean; beforeIndexSearch : Boolean = false;
                        entity : StrFix = EmptyStr) : string;
// Error: Illegal expression

Reply by email

Jonas Maebe
to Ernest V Miller
Ernest V Miller wrote
Why assigning EmptyStr as default value in signature is not allowed while using it in body is OK?

Because default paramater have to be (symbolic) constants. EmptyStr is a typed constant, which is the same as an initialized variable.

Jonas

Reply by email

Ernest V Miller
to Jonas Maebe

Doh! These atavisms here and there and backward compatibilities scattered around units..
It was Borland's hack to introduce typed constants and I wonder these ancient workarounds
are still declared between ordinary initialized variables.

написано 26.03.2013 18:12:29:

Show quoted text 16 lines
On 26 Mar 2013, at 10:39, Ernest V Miller wrote: > Why assigning EmptyStr as default value in signature is not allowed > while > using it in body is OK? Because default paramater have to be (symbolic) constants. EmptyStr is a typed constant, which is the same as an initialized variable. Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email