View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0025143||FPC||Documentation||public||2013-10-04 17:49||2018-04-14 14:20|
|Reporter||Peter-Jan Roes||Assigned To||Michael Van Canneyt|
|Product Version||Product Build|
|Target Version||3.2.0||Fixed in Version||3.1.1|
|Summary||0025143: In Delphi mode: System.Integer does not equal Integer|
|Description||When in Delphi mode, type System.Integer seems to be a SmallInt while Integer is a LongInt. Both should map to a LongInt instead. In Free Pascal mode both types should map to SmallInt.|
|Steps To Reproduce||I have attached a test project that exposes the problem.|
|Tags||No tags attached.|
|Fixed in Revision||1482|
SystemIntegerNotEqualToInteger.dpr (281 bytes)
||This is because of the way how FPC implements delphi mode: delphi compatibility comes through an automatically loaded helper unit. We use this approach for >15 years and it was never a problem. Is this really a problem in real world code?|
I am in the process of trying to get a large Delphi codebase to compile with FreePascal. This code defined a TInteger32 as a System.Integer and finding out what was going wrong while calling some external component (the MSXML SAX parser) was really tricky. In the end I figured the problem out. In this sense it is a problem in real world code and solving this bug would improve out-of-the-box Delphi compatibility.
For me however, it is not really a problem as I changed the declaration of TInteger32 to LongInt and that works fine. I could not use the plain Integer type as TInteger32 was declared in a unit within the namespace "Integer" which hid the type Integer.
I already looked into the FreePascal source code quite a bit and I figured that solving this bug would be harder then one might think at first glance. However, I think it would be easy to solve if psystem.pas would be able to branch on the current compiler mode which I believe it cannot at the moment (it is created before lexical scanning). This might be difficult to implement but, if implemented, it might make other Delphi compatibility code easier to implement as well.
||This might also be worthy of at least a bit of documentation/warning|
" I think it would be easy to solve if psystem.pas would be able to branch on the current compiler mode which I believe it cannot at the moment (it is created before lexical scanning)."
Looks like a paradox.
||I propose to document this difference and leave it as it is. There is simply no reasonable solution due to the approache how fpc handles different language modes.|
||Documented in system.integer|
|2013-10-04 17:49||Peter-Jan Roes||New Issue|
|2013-10-04 17:49||Peter-Jan Roes||File Added: SystemIntegerNotEqualToInteger.dpr|
|2013-10-04 18:51||Florian||Note Added: 0070533|
|2013-10-04 19:20||Peter-Jan Roes||Note Added: 0070535|
|2018-02-24 18:20||Marco van de Voort||Note Added: 0106586|
|2018-02-24 18:52||Thaddy de Koning||Note Added: 0106588|
|2018-02-24 21:46||Florian||Note Added: 0106595|
|2018-02-24 22:36||Michael Van Canneyt||Assigned To||=> Michael Van Canneyt|
|2018-02-24 22:36||Michael Van Canneyt||Status||new => assigned|
|2018-02-24 22:36||Michael Van Canneyt||Category||Compiler => Documentation|
|2018-04-14 14:20||Michael Van Canneyt||Fixed in Revision||=> 1482|
|2018-04-14 14:20||Michael Van Canneyt||Note Added: 0107785|
|2018-04-14 14:20||Michael Van Canneyt||Status||assigned => resolved|
|2018-04-14 14:20||Michael Van Canneyt||Fixed in Version||=> 3.1.1|
|2018-04-14 14:20||Michael Van Canneyt||Resolution||open => fixed|
|2018-04-14 14:20||Michael Van Canneyt||Target Version||=> 3.2.0|