4 ms·
> Following the logic here, you seem to be implying that no-one except the irresponsible should use C. There are some platforms (such as embedded systems) wher
by LambdaComplex 10y ago
> Following the logic here, you seem to be implying that no-one except the irresponsible should use C.
There are some platforms (such as embedded systems) where C really is the only choice. But if you do have a choice? Then I don't think using C is a good idea.
I'm not sure if "irresponsible" is the right word, though. I think developers underestimate the risks of C's unsafety and/or overestimate their ability to properly deal with it. Hanlon's razor[0] applies.
0. https://en.wikipedia.org/wiki/Hanlon%27s_razor https://en.wikipedia.org/wiki/Hanlon%27s_razor
- nickpsecurity 10y ago"There are some platforms (such as embedded systems) where C really is the only choice. " That's never true. You can always use a higher-level, safer language that can compile to C. The result is C code but you never write it & avoid its pitfalls. Ivory language in Haskell, Ada-to-C, and Modula-2-to-C come to mind. Alternatively, you can use something even more primitive in a C subset or native assembly that it compiles to. OcaPIC or JavaCard come to mind. Astrobe Oberon is another for safe, low-level coding but not sure how its compiler works.
- adrianN 10y agoAdding an extra compilation step doesn't make debugging easier. The embedded C compilers also aren't known for their stability and standards compliance, so you'd likely have to massage your generated C to avoid bugs in the C compiler.
- nickpsecurity 10y agoThose are good points worth considering for a given tool.
- sametmax 10y agoNo you can write rust now.
- adrianN 10y agoNot for all targets.
- jsymolon 10y agoPer the Reenix OS implementation: "This boot-loader, unfortunately, did not support loading any kernel images larger than 4 megabytes. This turned into a problem very quickly as it turns out that rustc is far less adept than gcc at creating succinct output. In fact, I was hitting this problem so early I was barely able to make a “Hello World” before having to stop working on rust code. Fixing this problem required rewriting most of the early boot code, all of which was x86 assembly ..."
- Safety1stClyde 10y agoGiven a problem, C may or may not be the correct tool to solve it. Decrying C as so dangerous that it can never be safely used under any circumstances, as you and others on this discussion seem to be doing, is absolutely ridiculous, like trying to ban chefs from ever using sharp knives because they might cut themselves. Much of the software that we all currently rely on is in C, for example all of the common operating systems are in C, and the reliability of these operating systems shows very clearly that C is nowhere near as inherently dangerous as you claim it to be.