V
Vj
Hi all,
I'm finding some people in my company defining a version number as a
field to some structure.
The sample code goes as follows:
typedef enum _params_ver_ {
UNDEF = 0,
VERSION_1,
VERSION_LAST
} PARAMS_VER;
typdef struct _xyz_ {
PARAMS_VER version;
ULONG info;
} XYZ;
void DoSomething (XYZ asdf);
The argument for the same is as follows:
Suppose another field info2 is added to XYZ, the client using
DoSomething () needn't write any code to intialise the same.
Personally, I think a structure shouldn't have a version. Has anyone,
come across such an I/F ?? Is it recommended??
If the initialisation of the field is generally 0, a memset to the
structure by the client will solve the problem.
R
V
I'm finding some people in my company defining a version number as a
field to some structure.
The sample code goes as follows:
typedef enum _params_ver_ {
UNDEF = 0,
VERSION_1,
VERSION_LAST
} PARAMS_VER;
typdef struct _xyz_ {
PARAMS_VER version;
ULONG info;
} XYZ;
void DoSomething (XYZ asdf);
The argument for the same is as follows:
Suppose another field info2 is added to XYZ, the client using
DoSomething () needn't write any code to intialise the same.
Personally, I think a structure shouldn't have a version. Has anyone,
come across such an I/F ?? Is it recommended??
If the initialisation of the field is generally 0, a memset to the
structure by the client will solve the problem.
R
V