3 ms·
the way to do it has been known for years: https://groups.google.com/a/isocpp.org/g/std-proposals/c/-KVPhEKsEQY https://groups.google.com/a/isocpp.org/g/std-pro
by jcelerier 6y ago
the way to do it has been known for years: https://groups.google.com/a/isocpp.org/g/std-proposals/c/-KVPhEKsEQY https://groups.google.com/a/isocpp.org/g/std-proposals/c/-KV...
- zelphirkalt 6y agoThank you for that. It is great, that this is known for years. I am not a regular C coder, so I am merely asking out of curiosity. Could you supply a non-Google link to example code? Perhaps in some git repository or a code snippet on a non-Google snippet website?
- Quekid5 6y agoHere's an example of a similar library: https://github.com/foonathan/type_safe https://github.com/foonathan/type_safe
- zelphirkalt 6y agoAha, thank you, that's pretty cool! I wonder how they manage to make these types zero-overhead.
- jcelerier 6y agoIt can't be zero-overhead over e.g. int a,b ; a+b; It's however zero-overhead wrt a+b plus the manual error checking you'd have to do if you wanted to be correct