[fpc-devel] No default property value allowed for double type?

Peter Vreman peter at freepascal.org
Tue May 17 08:47:12 CEST 2005


> Hi,
>
> Is there a reason why one can't specify a default value for a property of
> type double, or is this a bug? (In the latter case I'll file it as a bug)
>
> Compiler version: 2.0.0, Win32
> OS: Win XP (though I guess that is irrelevant)
>
> Example code:
> ===========
> program DoublePropDefault;
>
> type
>   TMyClass = class
>   private
>     FA: double;
>   published
>     property A:double read FA write FA default 100;
>   end;
>
> begin
> end.
> ===========
>
> Compiler error:
> ===========
> DoublePropDefault.pas(10,48) Error: Property can't have a default value
> ===========
>
> Note: this code does compile when replacing 'double' for for example
> 'single'.

I don't know the reason why single is allowed. Delphi doesn't allow
default values for single or double.







More information about the fpc-devel mailing list