Hi,
There is NO direct replacement in Codewarrior for the structure
declaration you are referring to. Although I am not familiar with the
Cygwin/gcc compiler you mention, the declaration:
struct tfsdev alt_tfsdevtbl [TFSDEVTOT] = {
[0 ... (TFSDEVTOT-1)] =
{ (char *)0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
};
is basically telling the compiler to statically initialize all elements
in alt_tfsdevtbl (from 0 to (TFSDEVTOT-1)) to the defaults:
{ (char *)0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
(If I am correct, that means that the tfsdev structure contains 7
"elements/fields").
To make a similar declaration in Codewarrior you must do the following:
struct tfsdev alt_tfsdevtbl [TFSDEVTOT] = {
{ (char *)0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff }, //0
{ (char *)0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff }, //1
{ (char *)0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff }, //2
...
{ (char *)0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff }, // TFSDEVTOT-2
{ (char *)0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff }, // TFSDEVTOT-1
};
If TFSDEVTOT is too big, try to encapsulate the initialization in a
function:
for ( i = 0; i < TFSDEVTOT; i++ )
{
alt_tfsdevtbl [i].xxxxxxx = 0xffffffff;
alt_tfsdevtbl [i].xxxxxxx = 0xffffffff;
...
OR
memset ( &alt_tfsdevtbl[i], 0xFF, sizeof ( struct tfsdevtbl ));
}
Regards
Rene Trenado
to
karthikbg wrote:
> Hi ,
>
> While trying to port to Codewarrior environment, i find that the below
> type of structure declaration is supported only in cygwin/gcc but not
> in Codewarrior. It breaks in codewarrior environment.
>
> Has anyone come across such a thing and could someone here tell me an
> equivalent alternative for
> this so that i can use in codewarrior environment.
>
> struct tfsdev alt_tfsdevtbl[TFSDEVTOT] = {
> [0 ... (TFSDEVTOT-1)] =
> { (char *)0xffffffff, 0xffffffff, 0xffffffff,
> 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
> };
>
> char alt_devnames[TFSDEVTOT][TFSNAMESIZE] = {
> [0 ... (TFSDEVTOT-1)] =
> { [0 ... (TFSNAMESIZE-1)] =
> 0xff }
> };
>
> Regards,
> Karthik Balaguru