int64类型的问题
delphi吧
全部回复
仅看楼主
level 1
z_g_j_
楼主
var a:int64;
begin
a:=-9223372036854775808;
edit1.Text:=inttostr(a);
end;
给int64类型变量a赋值-9223372036854775808(即-2^63)编译时会出现[Error] First.pas(30): Integer constant too large的错误,但是low(int64)的运行结果明明为-9223372036854775808,为什么不能赋值给int64类型变量?
2015年11月08日 03点11分
1
level 13
顶之座__赫卡特
新版本delphi就没这个问题。
2015年11月08日 04点11分
2
吧务
level 14
BambooCaep
试试a := Int64(-9223372036854775808);
2015年11月10日 05点11分
4
顶之座__赫卡特
没用。
2015年11月10日 10点11分
BambooCaep
@顶之座__赫卡特
那他就只有换高版本了
2015年11月10日 11点11分
ayi033
@BambooCaep
楼主讨论的应该是为什么编译器不允许直接赋值吧,如果是要怎么赋值方法有很多.a:=Low(int64);a:=Int64($8000000000000000);等等. a:=-9223372036854775807;就可以,到8就不行了.哎,也懒得研究.
2015年11月12日 01点11分
BambooCaep
@ayi033
嗯,低版本delphi的bug。
2015年11月12日 02点11分
1