Explicit casts |
Top Previous Next |
What is translated > Assignments > Explicit casts Generally, if a variable of one type is assigned to another variable with another type this is possible without problems, if no information is lost. For example, if a shortint variable is assigned to an integer variable, there is no problem, because the size of shortint is one byte and the size of an integer variable is at least two bytes. If the assignment goes the other way round however in C# an explicit cast is necessary:
si : shortint; i : integer; begin i := si; si := i;
becomes to:
signed char si = 0; int i = 0; i = si; si = (signed char) i;
Delphi2Cpp always inserts the according casts, also when such casts are necessary to pass parameters to functions. Especially such casts often are necessary for void pointers.
|
This page belongs to the Delphi2Cpp Documentation |
Delphi2Cpp home Content |