On 03.11.2015 20:26, Mattias Gaertner wrote:
procedure Test;
>var
> I: Integer;
> S: SmallInt;
>begin
> Res := I + S;
>end;
>
>Something like:
>1.)
>I = (Integer -> longint)
>S = SmallInt
>2.)
>ResultBasicType = Compare(longint, SmallInt) -> longint -> I
>3.)
>ResultType = ResultBasicType -> I ->*Integer*
That would fail with the following example:
var
i: SizeInt;
j: SmallInt;
begin
k:=i+j;
end;
The result should be SizeInt, not Integer.
No, the result will be SizeInt, because (SizeInt -> LongInt) wins over
SmallInt and the result thus will be SizeInt (as the original type alias
of /*i*/) and not Integer.
A problem could be with such code:
var
i: SizeInt;
j: Integer;
begin
k:=i+j;
end;
Because obviously on 32bit SizeInt=longint and Integer=longint, so there
won't be a deterministic way which type wins.
Ondrej
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus