I wish people referring to "the documentation" would first refer to the real documentation: the manuals. And not the wiki.
Of course, but in wiki it is clearly written (about dependence of modes). Real documentation describes this:
The integer type maps to the smallint type in the default Free Pascal mode. It maps to either a longint in either Delphi or ObjFPC mode.
This is first tip. Second tip is in bullet list:
1. Every platform has a ”native” integer size, depending on whether the platform is 8-bit, 16-bit, 32-bit or 64-bit. e.g. On AVR this is 8-bit.
Hmm… And the third tip is in point
3. b. (points
a. and
c. are not applicable in my case):
3. The result of binary arithmetic operators (+, -, *, etc.) is determined in the following way:
b. If both operands have the same signedness, the result is the same type as them. The only exception is subtracting (-): in the case of unsigned-unsigned subtracting produces a signed result in FPC (as in Delphi, but not in TP7).
In summary, if the numeral literal (in my case
5) is an
Integer, and the
Integer type is 32-bit wide in
ObjFPC mode on 64-bit platform, the result of expression must be 32-bit wide and my
TIntegerHelper must be used.
As far as I can see, it is not like that at all. If the point
3. b. is true, the numeral literal on 64-bit platform is not 32-bit wide, so the compiler behavior is correct and I need helper for
Int64. I do not understand something here—what is the type of literal
5 on 64-bit platform?
Int64? Is it treated the same way as ordinal constants or in different way?
Please be patient, I would like to understand it thoroughly and no longer have any doubts. Thank you for help.