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 |
|
01/30/12
Delphi2Cpp 1.6.3 Better construction of objects [more...] |
|
01/05/12
Delphi2Cpp 1.6.2 Resource strings and more [more...] |
|
[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
|
|
This website is generated from plain text with [Minimal Website ]
|
Minimal Website
is made with TextTransformer
|
TextTransformer is made with Borland
CBuilder
|