Sign in Join

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

Mailing lists / fpc-pascal / 2008-10

Extended property can't have default value?

9 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

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

Graeme Geldenhuys

Why is the following not allowed in a class declaration?

    property Increment: extended read FIncrement write SetIncrement default 1.0;

yet this is...

    property Increment: integer read FIncrement write SetIncrement default 1;

What would be the major obstacle between Extended and Integer types? How can I overcome this issue?

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Jonas Maebe
to Graeme Geldenhuys
Graeme Geldenhuys wrote
Why is the following not allowed in a class declaration? property Increment: extended read FIncrement write SetIncrement default 1.0;

Because default values are stored in a 32 bit location inside the compiler. I have no idea what the reason for this is, how Delphi does this and what it allows, whether this not only a matter of the compiler but also of the rtti, ...

How can I overcome this issue?

You cannot.

Jonas

Reply by email

Joao Morais
to Graeme Geldenhuys: Why is the following not allowed in a class declaration? property Increment: extended…
Graeme Geldenhuys wrote 12 lines
Why is the following not allowed in a class declaration? property Increment: extended read FIncrement write SetIncrement default 1.0; yet this is... property Increment: integer read FIncrement write SetIncrement default 1; What would be the major obstacle between Extended and Integer types? How can I overcome this issue?

Using stored instead of default?

Joao Morais

Reply by email

Michael Van Canneyt
to Jonas Maebe: Because default values are stored in a 32 bit location inside the compiler. I have no…
Jonas Maebe wrote 12 lines
On 06 Oct 2008, at 12:48, Graeme Geldenhuys wrote: >Why is the following not allowed in a class declaration? > > property Increment: extended read FIncrement write SetIncrement default > 1.0; Because default values are stored in a 32 bit location inside the compiler. I have no idea what the reason for this is, how Delphi does this and what it allows, whether this not only a matter of the compiler but also of the rtti, ...

FPC is 100% Delphi compatible as FPC. Default values for sets are also only allowed for sets that fit in 32-bits. We can change this, but that would require quite some work in the RTTI structures.

Michael.

Reply by email

Joao Morais
to Jonas Maebe: Because default values are stored in a 32 bit location inside the compiler. I have no…
Jonas Maebe wrote 12 lines
On 06 Oct 2008, at 12:48, Graeme Geldenhuys wrote: > Why is the following not allowed in a class declaration? > > property Increment: extended read FIncrement write SetIncrement > default 1.0; Because default values are stored in a 32 bit location inside the compiler. I have no idea what the reason for this is, how Delphi does this and what it allows, whether this not only a matter of the compiler but also of the rtti, ...

If this area is typed, and the size is 64 for the 64 bits compiler, you could store a pextended instead of the value itself. Just a thought.

Joao Morais

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt: FPC is 100% Delphi compatible as FPC. Default values for sets are also only allowed for…
Michael Van Canneyt wrote
FPC is 100% Delphi compatible as FPC. Default values for sets are also only allowed for sets that fit in 32-bits. We can change this, but that would require quite some work in the RTTI structures.

So do you think this will change in 64bit Delphi and then in 64bit FPC? RTTI structures also supporting 64bit values? It would make sense (to me at least). :-)

I just thought it odd that I couldn't use a simple type (I consider Extended a simple type, like Integer and String) in a property with a default value.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Marco van de Voort
to Graeme Geldenhuys

In our previous episode, Graeme Geldenhuys said:

Show quoted text 9 lines
On Mon, Oct 6, 2008 at 4:13 PM, Michael Van Canneyt wrote: > > FPC is 100% Delphi compatible as FPC. Default values for sets are also only allowed > for sets that fit in 32-bits. We can change this, but that would require quite some > work in the RTTI structures. So do you think this will change in 64bit Delphi and then in 64bit FPC?

Integer is still 32-bit on x86_64 ?

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys: On Mon, Oct 6, 2008 at 4:13 PM, Michael Van Canneyt So do you think this will change in…
Graeme Geldenhuys wrote 14 lines
On Mon, Oct 6, 2008 at 4:13 PM, Michael Van Canneyt wrote: > > FPC is 100% Delphi compatible as FPC. Default values for sets are also only allowed > for sets that fit in 32-bits. We can change this, but that would require quite some > work in the RTTI structures. So do you think this will change in 64bit Delphi and then in 64bit FPC? RTTI structures also supporting 64bit values? It would make sense (to me at least). :-) I just thought it odd that I couldn't use a simple type (I consider Extended a simple type, like Integer and String) in a property with a default value.

No, only ordinal types... Strings are also not supported.

Michael.

Reply by email