Integer Vs Long Confusion

前端 未结 7 1151
小鲜肉
小鲜肉 2020-11-27 18:49

I have seen many believe in the following

VBA converts all integer values to type Long

In fact, even the MSDN article says

7条回答
  •  囚心锁ツ
    2020-11-27 19:47

    An integer declared as an Integer is still type checked as an Integer. The msdn documentation is referencing how the variable is stored internally. On a 32 bit system, an Integer will be stored in 32 BITS not Bytes, while on a 16 bit system the value is stored in a 16 BIT space or register, it would have been stored in 16. Hence the maximum size.

    There is no type conversion going on as far as VBA is concerned. An int is an int and a long is a long, even though they now take up just as much space.

提交回复
热议问题