News for hackers. Stuff that matters.
Re:C Portability Lessons from Weird Machines by setr on Thursday November 15, 2018 @11:32PM (#18466428)
>Basically, a "non-DSP, non-mainframe" version of C

I feel like if you start going down that road, towards “commonly portable”, you naturally end up with one of the not-c variants (zig, nim, etc). ...and ifc, if you start writing a new language, you might as well toss in features from the last thirty years of language design.

C is C largely because its so stupidly (and impressively) portable; if you aren’t drawing that benefit, its likely a case of the wrong tool for the job.

Re:C Portability Lessons from Weird Machines by carlmr on Friday November 16, 2018 @02:46AM (#18467232)
>C is C largely because its so stupidly (and impressively) portable; if you aren’t drawing that benefit, its likely a case of the wrong tool for the job.

I'm working in medium sized embedded systems (not embedded Linux, but also not the smallest embedded systems). I've only rarerly worked on 8 or even 16bit Microcontrollers. Most of what I work on is 8bit chars, 32bit, Little Endian normal Microcontrollers.

I really don't need the portability, the targets are all the same, however they only have C/C++ compilers. And we can't use GC. Rust would be a very nice choice at least for the application code. I'm not sure how to write low level drivers in Rust, but with FFI I would just push that to the boundaries, and make at least 90% of the applications Rust. But there's no LLVM backend for most embedded processors I work with, and even if there is, the maturity might not be there, and no company would switch to that considering that the next target might not have a backend.

We have to use C, because it's the only thing that we are offered. But for desktop applications I see no real reason to start something in C nowadays.

Re:C Portability Lessons from Weird Machines by pjmlp on Friday November 16, 2018 @04:09AM (#18467540)
Some microcontrollers do enjoy Basic and Pascal compilers as alternatives to C.

https://www.mikroe.com/compilers

But as you say, the company needs to give the option to developers.

Re:C Portability Lessons from Weird Machines by int_19h on Friday November 16, 2018 @08:24AM (#18468535)
The point is that we already have millions of lines of code written in this less-portable C dialect, and probably thousands more are written every year. So no, it's not the same as a new language (for which all that code would need to be rewritten).
Re:C Portability Lessons from Weird Machines by hamiltonkibbe on Friday November 16, 2018 @01:21AM (#18466878)
I think in a lot of cases it’s the only tool for the job. I have a hunch that a significant majority of the machine instructions executed in a given second globally came from C source code, and a large portion of that is running on something “weird”. It’s somewhat funny, “commonly portable” C is portable across the most uncommon C execution environments.
Re:C Portability Lessons from Weird Machines by adamson on Friday November 16, 2018 @02:11AM (#18467089)
psst, your personal website is returning a 502
Re:C Portability Lessons from Weird Machines by hamiltonkibbe on Friday November 16, 2018 @12:59PM (#18470499)
Thanks for the heads up!