VB6 是否短路复杂条件?
问题描述:
VB6 是否进行短路条件测试?也就是说,我能确定像...这样的声明吗
Does VB6 short circuit conditional tests? That is to say, can I be sure a statement like...
If index <= array_size And array(index) > something Then
永远不会使数组爆裂,无论 index 的值是什么?
will never burst the array, whatever the value of index might happen to be?
答
不,VB6 的 And
和 Or
不会短路(这就是为什么短路版本在 VB.net 中称为 AndAlso
和 OrElse
- 向后兼容性).
No, VB6's And
and Or
don't short-circuit (which is the reason why the short-circuit versions are called AndAlso
and OrElse
in VB.net — backward compatibility).