Special assignments |
Top Previous Next |
What is translated > Assignments > Special assignments
In Delphi the contents of array variables of the same type can be assigned directly. In C++ the assignment has to be done via pointers to the first array element by means of the functions "strcpy" or "memcpy":
Assignments to character arrays is done with "strcpy".
var chr10 : array[1..10] of char; begin chr10 := 'abcdefghij';
->
char chr10[ 10/*# range 1..10*/ ]; strcpy( chr10, "abcdefghij" );
Assignments of other static arrays are done with "memcpy".
procedure test(xArr: TObjectArray); var arr: TObjectArray; begin arr := xArr; end;
->
void __fastcall test( const TObjectArray& xArr ) { TObjectArray arr; memcpy( arr, xArr, sizeof( TObjectArray ) ); } |
This page belongs to the Delphi2Cpp Documentation |
Delphi2Cpp home Content |