Why? Why I can use methods in both ways on 32-bit and cannot do the same on 64-bit?For some reason the 64-bit Expression version requires a cast to keep the compiler happy
On 64-bit platforms the expression may be Int64 internally? The typehelper is specific for longint.
Currently, the integer type is only dependent on $mode, not on the CPU type. An integer is 16-bit in TP or FPC modes, or 32-bit in ObjFPC or Delphi modes.
The issue is not the size of the integer type, but the size of the expression, the result of two integers being added. This was the point of "internally" in my comment.On 64-bit platforms the expression may be Int64 internally? The typehelper is specific for longint.
Hmm… the documentation (http://wiki.freepascal.org/Integer) says something else:Quote from: IntegerCurrently, the integer type is only dependent on $mode, not on the CPU type. An integer is 16-bit in TP or FPC modes, or 32-bit in ObjFPC or Delphi modes.
I'm using ObjFPC always, so the Integer type should be 32-bit wide, but apparently it is not.
I wish people referring to "the documentation" would first refer to the real documentation: the manuals. And not the wiki.
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.
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.
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).