Order of lookup |
Top Previous Next |
What is translated > Types > Order of lookup The order by which symbols are looked up is different in Delphi and C#. Delphi tries to find a symbol in the last used unit at first and if it isn't there Delphi will continue with the previous used unit. If both used units contain the same symbol, but defined differently, this doesn't matter, because Delphi will take just the definition, that it finds first. In the following example MyType will be an integer:
uses lookupinunits2, // LType = TestRecord; lookupinunits1; // LType = Integer;
Type MyType = LType;
implementation
procedure foo; var i : integer; m : MyType; t : TestRecord; begin m := i; // m := t; E2010 incompatibe types: 'Integer' and 'TestRecord' end;
In the translated C# code there are no type definitions, but m correctly becomes an integer, not a TestRecord.
public static void foo() { int i = 0; int m = 0; TestRecord T = null; m = i; // m := t; E2010 incompatibe types: 'Integer' and 'TestRecord' }
Remark: In C# both definitions of LType would conflict. If LType would denote pointer types, then there would be an ambiguity.
|
This page belongs to the Delphi2C# Documentation |
Delphi2C# home Content |