3 ms·
As maddening as it may be, my gut tells me it has more to do with the precompiler than anything else. When it comes to wrestling with cross-platform difference
by jstewartmobile 9y ago
As maddening as it may be, my gut tells me it has more to do with the precompiler than anything else. When it comes to wrestling with cross-platform differences, I don't know of a corresponding feature in Rust or Go that is equally powerful (or equally ugly!).
As long as computing remains a battleground where rich assholes put vastly different wrappers around the exact same shit so they can wring more money out of us, I will probably be writing in that abominable assembly language w/ turing-complete string-paster for many years to come.
- kibwen 9y agoSpeaking of the C preprocessor, I found this recently: from the Firefox source code, a red-black tree written entirely in 800 lines of C macros: http://searchfox.org/mozilla-central/rev/f54c1723befe6bcc7229f005217d5c681128fcad/memory/build/rb.h http://searchfox.org/mozilla-central/rev/f54c1723befe6bcc722... . Submitted for your enjoyment. :)
- jstewartmobile 9y agoI've used OpenBSD's version of that more times than I care to remember: http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/sys/tree.h?rev=1.29 http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/...
- nikbackm 9y agoLooks to be some small amount of C code in those macros as well.
- throwme211345 9y agoWhy would someone do that?
- dboreham 9y agoBecause long ago (and probably in a different product) making a function call was significantly costly and worthwhile optimizing away via macros.
- jstewartmobile 9y agoThat is how we do "generics" in C. Not happy about it, just sayin'.
- naasking 9y agoThere are whole libraries that provide these sorts of generic containers for C: http://sglib.sourceforge.net/ http://sglib.sourceforge.net/ http://klib.sourceforge.net/ http://klib.sourceforge.net/ https://github.com/pmj/genccont https://github.com/pmj/genccont