In c(not c++), is there a way to check the identity of the definitions of two structures with different tags?

99 Views Asked by At

In c(not c++), is there a way to check in compile time the identity of the definitions of two structures with different tags? Do they consist of the same set of fields in the same order?

1

There are 1 best solutions below

4
Ætérnal On

To my knowledge, it is not possible in C to iterate over struct members, which is what you'd probably have to do. Best you can do is check if two variables/types have the same size using sizeof or if two variables are of the same type.