Board index » cppbuilder » Problem with default value of a double property

Problem with default value of a double property


2004-09-23 10:39:21 PM
cppbuilder111
Hi,
I defined a property :
private:
double FZoomCoefficient;
__published:
__property double ZoomCoefficient = { read=FZoomCoefficient,
write=FZoomCoefficient, default=1.25 };
When I compile, I have an error : E2313 Constant expression required in the
"__property" line.
If I replace "1.25" with "1.0", I have the same problem but if I replace
"1.25" with "1", there is none error.
It seems that C++ Builder only accept integer default value for a property
defined as a double.
Is there a mean to define a double default value for a double property ?
Thanks
Jean-Francois
 
 

Re:Problem with default value of a double property

Hi,
I defined a property :
private :
double FZoom;
__published:
__property double Zoom = {read=FZoom, write=FZoom, default=1.25};
when I compile with BCB6 (French version) I have an error : "E2313
Expression constante nécessaire" in the "__property" line.
If I replace "1.25" with" 1.0" (or "1.") I also have the error.
But if I replace "1.25" with" 1" I have none error.
It seems a double property can only have an integer default value.
How can I make to have BCB accepting a double default value for a double
property ?
Thanks for your help.
Jean-Francois
 

Re:Problem with default value of a double property

"Jean-Francois Becan" < XXXX@XXXXX.COM >wrote in message
Quote
How can I make to have BCB accepting a double default
value for a double property ?
You can't. The 'default' clause does not support floating point values at
all.
Gambit
 

{smallsort}

Re:Problem with default value of a double property

Quote
>How can I make to have BCB accepting a double default
>value for a double property ?

You can't. The 'default' clause does not support floating point values at
all.
Thanks for your answer.
It seems to be a lack.
Is there a reason for not supporting floating point default value ?
Thanks
Jean-Francois