集合这样定义为什么没有错(50分)

F

fj218

Unregistered / Unconfirmed
GUEST, unregistred user!
首先定义一个集合
type
TLocation=1..9;
TLocations=set of TLocation;
然后声明一个集合实例
s:Tlocations;
如果赋值
s:=[15];
为什么运行时不报错
我已经在options选择了Range checking
如果不会报错的话,程序运行有没有意想不到结果?
 
s 只能取1到9范围内的数据。
 
我用GetEnumName函数试过,设计期不会报错
可是运行时,哼哼
非法存取错误,请访问地址0x00000001.
 
比较:
TLocation = (a, b, c);
TLocations = set of TLocation;


var
s: Tlocations;
begin
s := [d];
//出错
 
肯定会超出范围的,操作系统这关是过不去的!~~~
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
I
回复
0
查看
715
import
I
I
回复
0
查看
604
import
I
顶部