C
Control Freq
Hi,
Apologies if you have heard this before, But,
I have inherited a large project, and I have found a struct defined in
one header file, and another structure of the same name in another
header file.
Now, the two structs are *almost* the same, but one has a char array
larger than the other.
It looks like the two structs should be identical, and one header file
should have been used throughout.
But, the connection has been lost at some point in history.
I discovered it when my program crashed when a pointer to the struct
was used in a function - with the different struct definition. It
stomped on the return address.
Anyway, I am concerned that this might be a timebomb in other places
in the project.
Is there a way that the compiler (or linker) can warn me that there is
a structure size problem like this?
Looking forward to your response.
Regards
Apologies if you have heard this before, But,
I have inherited a large project, and I have found a struct defined in
one header file, and another structure of the same name in another
header file.
Now, the two structs are *almost* the same, but one has a char array
larger than the other.
It looks like the two structs should be identical, and one header file
should have been used throughout.
But, the connection has been lost at some point in history.
I discovered it when my program crashed when a pointer to the struct
was used in a function - with the different struct definition. It
stomped on the return address.
Anyway, I am concerned that this might be a timebomb in other places
in the project.
Is there a way that the compiler (or linker) can warn me that there is
a structure size problem like this?
Looking forward to your response.
Regards