3 ms·
"Sometimes you just don't have other options than C." You always have other options if better languages can compile to C or integrate it via FFI. There's been
by nickpsecurity 9y ago
"Sometimes you just don't have other options than C."
You always have other options if better languages can compile to C or integrate it via FFI. There's been plenty to do that, too. For simple and safe, Modula-2 was early one compiled to C that couldve had syntax modified to be more like it. If aiming for power, PreScheme was a systems dialect of Scheme that compiled to C at one point. The OcaPIC (Ocaml) project and use of ATS language for 8-bit show stuff like that could probably be made to wofk in areas C is used in, too.
So, I'd say it's a myth you need to develop in C just because a target has only C libraries or compilers that safer languages can use. Instead, we get a new claim that people just didnt do it for reasons that varied per project or person but wasn't technical capability.
- kurtisc 9y agoFor the microcontrollers example, the 'C' that the device's compiler uses could be a very loose implementation of a subset of the language. How do you ensure that the code you're compiling to will work for it?
- nickpsecurity 9y agoThat's a good point. I doubt most languages generating C put a lot of thought into what subset is supported in proprietary compilers. If anyone tries one, then there could be profiles done for unusual compilers where the generated code has certain properties. Far as the past, I think people couldve tested the output just to see what happened. Then, either ditch high-level language per fuction, module, or project depending on how far incompatibility effects went. How does that sound?
- pjmlp 9y agoDepends on the microcontroler. The majority of them also enjoy Pascal and Basic compilers. https://www.mikroe.com/ https://www.mikroe.com/ So sometimes, there is indeed an option. Also many languages have compilers that are able to generate C code. As to ensuring, well that is what testing is for.