3 ms·
Actually, you can just have a public version of a struct and a private version of a struct with more fields. You can give callers the public version and then c
by ReflectedImage 3y ago
Actually, you can just have a public version of a struct and a private version of a struct with more fields.
You can give callers the public version and then cast it to the private version for internal usage.
- bluejekyll 3y agoThese will have different sizes though, so it’s only safe to cast when used off the heap and where it’s memory is allocated with the larger variant, right? I guess my point is that there’s a whole bunch of caveats in regards to safety that need to be considered in your solution.
- ReflectedImage 3y agoIt's not my solution, it's just something I've seen done in commercial C software.