Predefined identifier CSHARP |
Top Previous Next |
Pretranslated C# code > Preparing Delphi code > Frequent re-translation > Predefined identifier CSHARP
In addition the the definitions which the user can set in the translation options the identifier CSHARP always is defined in Delphi2C#. The preprocessor treats this identifier in a special manner. The pre-processor not simply writes the according code into the pre-processed code, but it puts it into the special brackets (*#_ ... _#*). In a second step the translator then removes the brackets.
For example:
{$ifdef CSHARP} out << s << endl; {$else} WriteLn(s); {$endif}
The pre-processed code then is:
(*#_ out << s << endl; _#*)
and because of the special treatment of the brackets (*#_..._#*), the final C# output is:
out << s << endl;
Delphi2C# ignores the part of code in the {$else}-section completely, but it is visible to the Delphi compiler. So, this special manner of the conditional compilation makes it possible that both the original Delphi code and the generated C# code remain compiling.
The identifiers in these section either can be normalized or can be left untouched. This is controlled by the CSHARP unification option.
|
This page belongs to the Delphi2C# Documentation |
Delphi2C# home Content |