| ▲ | procaryote 10 hours ago | |
Why would you want to avoid using a struct? Add a macro that declares the appropriate struct and get at least a tiny bit of type checking. With some clever use of _Generic you could even build specialised functions for that type and get pretty good type checking | ||
| ▲ | sparkie 10 hours ago | parent [-] | |
In C23 this approach is nice, but in older versions of C we end up with awful macros where we need to define the structure before we use it.
C23 has relaxed rules for redefining the same struct, so we can avoid having to create the struct up front. | ||