[Lazarus] Lazarus in trunk not working after Rev 50151 on MacOSX
Ondrej Pokorny
lazarus at kluug.net
Thu Nov 5 07:36:53 CET 2015
On 03.11.2015 20:26, Mattias Gaertner wrote:
> Of course there are some hard coded defaults in codetools. For example
> "i:=3" can be any integer type.
It would be nice if integer constants were able to resolve their type:
3 -> ShortInt
180 -> SmallInt
etc etc.
This would be good for:
var
b: Byte;
begin
i := b + 500;
end;
this code creates "i: Byte;" in r50230.
I still think it is better than the behavior before r50230 that created
"i: Integer;" for:
var
b: Byte;
begin
i := b + 1;
end;
Because adding a constant out of the bounds of one operand is much less
common than within its bounds (IMO).
> But what type should "i:=3.0" create? Single, Double, Extended,
> glFloat?
Yes, whatever: single, double, extended, glFloat - maybe create an IDE
option for default integer/float/string/boolean types? The user then can
decide what precision he wants to use by default. Do you think it is
possible?
The integer predefined setting should be preferred to the resolved type
in case there is no well-defined variable. E.g.:
i := 10 + 5;
Should create the user-defined default integer type ("i: integer" by
default) and not "i: Byte".
Ondrej
More information about the Lazarus
mailing list