Ampersand

Top  Previous  Next

What is translated > Tokens > Ampersand

By means of an ampersand Delphi keywords can be used as identifiers, e.g. \Embarcadero\Studio\19.0\source\rtl\win\winrt\WinAPI.ShlObj.pas  line 11032:

 

type

  tagDROPDESCRIPTION = record 

    &type: TDropImageType;   

 

or \Embarcadero\Studio\19.0\source\rtl\win\winrt\WinAPI.CommCtrl.pas line 1429:

 

&type: UINT;

 

 

The Delphi2Cpp II pre-processor and parser can reckognize such tokens as identifiers, but the translation will result in type names that are forbidden in C++:

 

UINT &type;

 

 

There are four possibilities to handle such cases:

 

let the pre-processor substitute such expressions
let the translator substitute such expressions
modify the source code
make manual corrections afterwards

 

 

Another example is in  \Embarcadero\Studio\19.0\source\rtl\win\winrt\WinAPI.DataRT.pas  line 598:

 

 

property &Implementation: Xml_Dom_IXmlDomImplementation read get_Implementation;

 

 

\rtl\win\winrt\WinAPI.Devices.pas line 6078:

 

 

property &Function: Word read get_Function;

 

 

\rtl\win\winrt\WinAPI.CommonTypes.pas line 138/439/544/6163...

 

&End

 

Inside of the class TParallel in System.Threading there are a lot of overloaded "&For" functions.

 

 

 



This page belongs to the DelphiXE2Cpp11 Documentation

DelphiXE2Cpp11 home  Content