| ▲ | Joker_vD 2 hours ago | ||||||||||||||||
> Now you have a naming problem. You need a naming convention that every user of the list library must follow, or else their types will be incompatible. Oh, that's simple: just have empty struct tags. > And what about typedefs? The names introduced by the typedefs are irrelevant. > A and B are typedef-related (their normal forms, obtained by following all typedefs, are the same), lists of A and B will be incompatible unless users agree on a common name. Huh?
The structs list_of_A and list_of_B are compatible. | |||||||||||||||||
| ▲ | uecker 2 hours ago | parent | next [-] | ||||||||||||||||
No, any tagless type is unique, so neither A and B nor list_of_A and list_of_B are compatible. This is what I like to fix in C2y outside of typedefs (and it would really help if you file wishlist bugs with compilers if you agree). | |||||||||||||||||
| ▲ | el_pollo_diablo 2 hours ago | parent | prev [-] | ||||||||||||||||
> The structs list_of_A and list_of_B are compatible. No, they are not. From C23, 6.7.3.4 Tags: Each declaration of a structure, union, or enumerated type which does not include a tag declares a distinct type. | |||||||||||||||||
| |||||||||||||||||