Static arrays

Top  Previous  Next

What is translated > Static arrays


Static arrays in C++ are declared siimilar as in Delphi:


TArray2 = array [1..10] of Char


typedef char [ 10 ] TArray2



While in Delphi the lower bound and the upper bound have to be defined, in C++ arrays are always zero based, i.e. the undermost index is 0 and the topmost index is the size of the array minus 1.

Up to the version 1.2.4. of Delphi2Cpp it was the strategy to size the C++ arrays as the upper bound of the original Delphi array plus one. This strategy was changed with version 1.2.5. From now on the size of the C++ array is determined by the number of elements, i.e. that genuine zero based arrays are used. 


This MAXIDX macro is used, when a static array is passed to a function, which accepts an open array.





This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content