|
|
导航: |
论坛 -> DELPHI技术
斑竹:liumazi,sephil |
|
作者: |
dalas (dalas) |
★☆☆☆☆ |
-
|
普通会员 |
|
2022/6/22 18:25:57 |
标题: |
这算BUG吗?数组默认最小下标是0吧?为何-1也不报错? |
浏览:158 |
|
加入我的收藏 |
楼主: |
var Rects:Array of TRect; i:Integer; begin SetLength(Rects,10); try i:=0; Application.MessageBox(PChar('没出错! '+Rects[i-1].Right.ToString+' '+(i-1).ToString), '', 0); except Application.MessageBox(PChar('出错了 '+(i-1).ToString), '', 0); end; end;
这个代码,居然不会执行到 except 下的代码,是BUG吗?
此帖子包含附件:
 大小:4.2K |
----------------------------------------------
- |
作者: |
janker (janker) |
★☆☆☆☆ |
-
|
盒子活跃会员 |
|
2022/6/22 18:54:28 |
1楼: |
好像release下默认关闭了范围检查。 在Debug下加上{$R+}..{$R-},也不会出错.........
----------------------------------------------
-
|
作者: |
|
2022/6/22 20:51:07 |
2楼: |
check your "Project - Options"
此帖子包含附件:
 大小:19.0K |
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!
|
|