problem with structure

R

ramu

HI,
Can anyone please explain this declaration?

typedef PACK_PREFIX struct {
CS_parm_id_t id;
CS_parm_type_t type;
CS_parmMakeup_t makeup;
PACK_PREFIX union {
ULONG enumerated;
ULONG numerical;
sint32 arithmetic;
char *string;
uint32 uint32num;
CS_internal_AID_t aid;
} PACK_SUFFIX val;
} PACK_SUFFIX CS_parm_t;


Thanks n Regds
 
W

Walter Roberson

ramu said:
Can anyone please explain this declaration?
typedef PACK_PREFIX struct {
CS_parm_id_t id;
CS_parm_type_t type;
CS_parmMakeup_t makeup;
PACK_PREFIX union {
ULONG enumerated;
ULONG numerical;
sint32 arithmetic;
char *string;
uint32 uint32num;
CS_internal_AID_t aid;
} PACK_SUFFIX val;
} PACK_SUFFIX CS_parm_t;

CS_parm_t is defined as an alternate name for a structure.

The components of the structure are named id, type, makeup, and val,
of type CS_parm_id_t, CS_parm_type_t, CS_parmMakeup_t, and union
respectively. The val union members can named be any of enumerated,
numerical, arithmetic, string, uint32num, or aid, of types
ULONG, ULONG, sint32, char*, uint32, or CS_internal_AID_t .

In the snippet shown, the non-basic types CS_parm_id_t, CS_parm_type_t,
CS_parmMakeup_t, ULONG, sint32, and CS_internal_AID_t have not
been defined, so we can't tell you much about them.

PACK_PREFIX and PACK_SUFFIX could be any of a number of things, but
they are very likely macros and probably on -most- systems
are defined as empty -- that is, for -most- systems you would
probably read the declarations as if PACK_PREFIX and PACK_SUFFIX
were simply not there at all. However, on some system or other,
they are likely defined using some implementation-dependant
extension.

On some system, PACK_PREFIX might be defined as the token packed
and PACK_SUFFIX might be defined as empty. On some other system,
PACK_PREFIX might plausibly be defined as something like __packed{
and PACK_SUFFIX might be defined as } . Hard to say, since PACK
is not a standard part of C (and when it exists, it is often
handled through #pragma packed). -Something- system-specific,
hard to say what.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top