News for hackers. Stuff that matters.
Re:The Curious Case of the Longevity of C by jstewartmobile on Tuesday October 03, 2017 @05:43AM (#15391257)
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.

Re:The Curious Case of the Longevity of C by kibwen on Tuesday October 03, 2017 @06:11AM (#15391336)
Speaking 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/f54c1723befe6bcc722... . Submitted for your enjoyment. :)
Re:The Curious Case of the Longevity of C by naasking on Tuesday October 03, 2017 @10:08AM (#15392502)
There are whole libraries that provide these sorts of generic containers for C:

http://sglib.sourceforge.net/

http://klib.sourceforge.net/

https://github.com/pmj/genccont

Re:The Curious Case of the Longevity of C by jstewartmobile on Tuesday October 03, 2017 @06:33AM (#15391416)
I've used OpenBSD's version of that more times than I care to remember: http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/...
Re:The Curious Case of the Longevity of C by nikbackm on Tuesday October 03, 2017 @07:30AM (#15391627)
Looks to be some small amount of C code in those macros as well.
Re:The Curious Case of the Longevity of C by throwme211345 on Tuesday October 03, 2017 @09:34AM (#15392259)
Why would someone do that?
Re:The Curious Case of the Longevity of C by dboreham on Tuesday October 03, 2017 @11:24AM (#15392998)
Because long ago (and probably in a different product) making a function call was significantly costly and worthwhile optimizing away via macros.
Re:The Curious Case of the Longevity of C by jstewartmobile on Tuesday October 03, 2017 @04:39PM (#15395969)
That is how we do "generics" in C. Not happy about it, just sayin'.