P
prashna
Hi all,
Consider a function which gives huge number of datum in the form of
array. I know how the data is arranged in the array (i.e. what index
stores what data).
void foo( int32 *data);
The parameter I am passing to this function is an array declared in
union and the other element in the union is the structure which
contains the list of all the data.
typedef struct
{
int32_t i1; /*Index 0*/
real32_t r1; /*Index 1*/
char string[4]; /*Index 2*/
.......
.......
}ns_data_list_t;/*All the elemnts are 32 bit*/
typedef union
{
real32_t name_strg_data[MAX_NS_DATA];
ns_data_list_t ns_data_list;
} ns_data_t;
I am passing ns_data.name_strg_data as the argument in which the data
is stored and I am accessing the data elements using the structure
ns_data_list_t.
Kindly let me know if this is not correct(At least on Linux). Is there
any other reliable, portable method of doing the same? Note that I
cannot change the prototype of the function foo.
I am using gcc on linux...
Consider a function which gives huge number of datum in the form of
array. I know how the data is arranged in the array (i.e. what index
stores what data).
void foo( int32 *data);
The parameter I am passing to this function is an array declared in
union and the other element in the union is the structure which
contains the list of all the data.
typedef struct
{
int32_t i1; /*Index 0*/
real32_t r1; /*Index 1*/
char string[4]; /*Index 2*/
.......
.......
}ns_data_list_t;/*All the elemnts are 32 bit*/
typedef union
{
real32_t name_strg_data[MAX_NS_DATA];
ns_data_list_t ns_data_list;
} ns_data_t;
I am passing ns_data.name_strg_data as the argument in which the data
is stored and I am accessing the data elements using the structure
ns_data_list_t.
Kindly let me know if this is not correct(At least on Linux). Is there
any other reliable, portable method of doing the same? Note that I
cannot change the prototype of the function foo.
I am using gcc on linux...