This article can be obsolete: Actual documentation online
Initializing arrays
Array's are initialized very simply in Delphi. The initialization of an array of TStyleRecord's:
TStyleRecord = record Name : string; Style : TFontStyles; end;
could look like:
DefaultStyles : TStylesArray = ( (Name : 'tnone'; Style : []), (Name : 'tstring'; Style : []), (Name : 'tcomment'; Style : [fsItalic]) );
This was translated in the earlier versions of Delphi2Cpp as:
TStylesArray DefaultStyles = {
{ "tnone" /*Name*/, arrays__0 /*Style*/ },
{ "tstring" /*Name*/, arrays__1 /*Style*/ },
{ "tcomment" /*Name*/, arrays__2 /*Style*/ }
};
It is a problem however, that such initializations are only possible, if the elements are built in types of C. Such initializations of elements of the type TFontStyle aren't permitted. Beginning with version 1.2.4., Delphi2Cpp therefore generates initialization functions which are called within the initialization routine of the corresponding unit (see above).
void DefaultStylesInit( )
{
DefaultStyles[0].Name = "tnone";
DefaultStyles[0].Style = arrays__0;
DefaultStyles[1].Name = "tstring";
DefaultStyles[1].Style = arrays__1;
DefaultStyles[2].Name = "tcomment";
DefaultStyles[2].Style = arrays__2;
}
Deutsch
| Latest News |
|
05/18/26
Delphi2Cpp 2.7: Translation heuristics [more...] |
|
11/18/25
Delphi2Cpp 2.6: Delphi Interfaces [more...] |
|
"Thanks for your great work, really appreciate the work you have done on zlib and compiling ... test case." Mattewada, Udayabhaskar
Nokia India
02/01/2021
|
|
[from case study...] "A masterpiece -- Delphi2Cpp has exceeded all my expectations by far." Tony Hürlimann
virtual-optima
08/20/2011
|
|
"First off, I have to say WOW! Delphi2Cpp is doing a *fantastic* job!" Daniel Flower
linkrealms
01/15/2011
|
|
"Though we have not finished the conversion yet, I'm glad that we've found you and could transform Eurocap to C++ with the help of Delphi2CB and you. (And I'm also glad that we could help you to make Delphi2CB better😉)"
Gáspár Huba
|
|
This website is generated from plain text with
[Minimal Website]
|
Minimal Website is made with TextTransformer
|
TextTransformer is made with Borland
C++Builder
|