luowy wrote:
how can do remove range check? I want to know.
By assigning to LONGINT first, as Robert showed us.
In general, you want to have as many compile-time checks as possible.
For the remaining cases you want to have as many run-time checks as possible.
Only if you have a good reason for not checking something, you omit them.
For INTEGER arithmetics there are good reasons:
They need extra code, they don't allow us to write efficient random number generators
or secure hashing, crypto algorithms, etc., and people are used to MOD 2^32 two's complement arithmetic.
Conversion from REAL to integer does not fall into this category and the check comes for free.
If you think that the code is more robust by eliminating run-time checks then we should remove all of them.
The checked SHORT(ENTIER) is not a problem for anybody, only a surprising behavior.
The surprise can be eliminated easily by adding documentation.
- Josef