View Issue Details

IDProjectCategoryView StatusLast Update
0025143FPCDocumentationpublic2018-04-14 14:20
ReporterPeter-Jan RoesAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionProduct Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0025143: In Delphi mode: System.Integer does not equal Integer
DescriptionWhen 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 ReproduceI have attached a test project that exposes the problem.
TagsNo tags attached.
Fixed in Revision1482
FPCOldBugId
FPCTarget
Attached Files

Activities

Peter-Jan Roes

2013-10-04 17:49

reporter  

SystemIntegerNotEqualToInteger.dpr (281 bytes)

Florian

2013-10-04 18:51

administrator   ~0070533

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?

Peter-Jan Roes

2013-10-04 19:20

reporter   ~0070535

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.

Marco van de Voort

2018-02-24 18:20

manager   ~0106586

This might also be worthy of at least a bit of documentation/warning

Thaddy de Koning

2018-02-24 18:52

reporter   ~0106588

" 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.

Florian

2018-02-24 21:46

administrator   ~0106595

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.

Michael Van Canneyt

2018-04-14 14:20

administrator   ~0107785

Documented in system.integer

Issue History

Date Modified Username Field Change
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