|
From: | WAEDT Karl NLTD-G (AREVA NP GmbH) |
Subject: | [Tinycc-devel] Initialization of arrays of structs that contain array elements / Motivation |
Date: | Tue, 6 Feb 2007 09:22:33 +0100 |
Hello TCC developers,
// Arrays of structs that contain array elements should(must?) be initialized as done below for a0.
// An incorrect(?) initialization as for a1 resulted in crashes (in more complicated cases)
// or a "memory full" report by tcc.exe.
// The VC2003 and GCC produce the expected executable.
// Alas, my small example does not reproduce the error.
// After modifying the initialization, I compiled several projects with a total of more than 100 MB
// of (mostly generated) C source code at an AMAZING speed.
// The execution speed was ca. 10% to 45% below that of the optimized VC2003 executables which is OK for me.
// I think most important is a corroboration of experience feedback and test suites (perhaps with additional
// developer and test documentation) that DEMONSTRATE a stable product, suitable for industrial use.
// From the product quality I experienced during my initial tests, this goals seems to be reachable within the near future.
// Again, I'm amazed by the lightning translation speed of huge projects.
// Note: I still have to try the pyinc integration into Python (on the Windows platform),
// which at the moment seems to be available only for Linux.
// tcc -c init_array_in_struct.c -Id:/opt/tcc/include
// tcc -run init_array_in_struct.c -Id:/opt/tcc/include d:/opt/tcc/lib/msvcrt.def
typedef struct {
char elem1;
double array1[4];
int elem2;
} Struct1;
static Struct1 a0[] = {
{ 1, { 1, 2, 3, 4 }, 5},
{ 1, { 1, 2, 3, 4 }, 5 },
{ 1, { 1, 2, 3, 4 }, 5 }
};
static Struct1 a1[] = {
{ 1, 1, 2, 3, 4 },
{ 1, 1, 2, 3, 4 },
{ 1, 1, 2, 3, 4 },
{ 1, 1, 2, 3, 4 },
{ 1, 1, 2, 3, 4, 5 },
{ 1, 1, 2, 3, 4, 5 },
{ 1, 1, 2, 3, 4, 5 }
};
static Struct1 a2[] = {
{ 1, 1, 2, 3, 4, 5 },
{ 1, 1, 2, 3, 4, 5 },
{ 1, 1, 2, 3, 4, 5 },
{ 1, 1, 2, 3, 4, 5 }
};
int main( int argc, char* argv[] )
{
return 0;
}
Kind regards
Seal
[Prev in Thread] | Current Thread | [Next in Thread] |