News for hackers. Stuff that matters.
Re:Let’s stop copying C (2016) by MrBuddyCasino on Wednesday January 23, 2019 @09:29AM (#18978349)
I suppose you mean something besides dead code elimination? Because that looks like it could be solved with proper encapsulation and abstraction mechanisms in the language, which C lacks.
Re:Let’s stop copying C (2016) by linuxlizard on Wednesday January 23, 2019 @10:27AM (#18978929)
It's a pretty amazing problem--a wifi chipset. The driver runs on Linux and Windows, also supports 3x different CPU architectures (x86, mips, arm) and multiple bus interfaces (SoC internal, usb, pci). Supports disabling optional features so 2.4Ghz only chipsets have a smaller memory footprint. Can build with/without different security options. And that's just starting in on the huge number IEEE 802.11 standards across the last 20 years. Some chips support some of the features, some don't -- but the driver still has to work on all of them.

Linux kernel is an amazing example of how to do ^^^that and still produce beautiful code. The Linux kernel uses a great number of function pointers to accomplish their encapsulation goal.

Re:Let’s stop copying C (2016) by MrBuddyCasino on Wednesday January 23, 2019 @11:18AM (#18979543)
I see where you're coming from. The description already gave me nightmares.
Re:Let’s stop copying C (2016) by Someone on Wednesday January 23, 2019 @01:26PM (#18981001)
Dead code elimination would require all code paths to be compilable by the compiler being run.

That need not be the case, and typically isn’t. If you do

   #if USE_FOO
     #include <foo.h>
   #endif
the foo.h header only need to be present on platforms where USE_FOO is defined, and need only be compilable on those platforms (it might use nonstandard compiler extensions, for example containing assembly instructions)