5 ms·
Actually, the only real advantage that C has over rust there is the availability of trimmed libcs.
by gcp 10y ago
Actually, the only real advantage that C has over rust there is the availability of trimmed libcs.
- qwertyuiop924 10y agoWhy would you use libc embedded? Most of libc kind of expects an OS to be there.
- gcp 10y agoUh? There are definitely trimmed libc's (not GNU libc!) that run on bare metal. Such as the one used by avr-gcc for example...
- qwertyuiop924 10y agoYeah, but why? I've never used a libc on embedded, and I'm kind of confused as to why you'd want to. Am I just Doing It Wrong™?
- saaadhu 10y agoAtleast for avr-gcc, (part of) startup code and vector table layout come from avr-libc. I'm kinda surprised you got by without libc - no strxxx, memxxx ,xxxprintf/no math.h functions ever?
- qwertyuiop924 10y agoNo. But my embedded projects weren't particularly impressive. I can at least see the need now.
- eggy 10y agoC seems to be going through yet another renaissance. C is a smaller language to learn. There is tons of legacy code even for embedded systems.
- gcp 10y agoC is a smaller language to learn. There are engineers with 20 years of C programming experience that will still make security errors while handling basic strings. "Small" does not mean "good" and "learning" a language doesn't mean you'll write good code with it.
- qwertyuiop924 10y agoNo, small is good. But C isn't small. It's actually massive, and not terribly orthogonal. It's peppered with special cases, and things people think but aren't actually true (how would you check for an integer overflow in C?). It's like comparing x86 to, say, m68k (or most things, really). One was designed. The other is an ungainly mess of hacks on top of hacks, which has a good, elegant design in there somewhere, desparately trying to get out. Guess which one is x86. Now guess which one is C. Worse really is better. Or at least, good enough. C isn't a complete mess, and you can write good code in it if you're very careful, but it's not great.
- dbaupp 10y agoRust has libcore, which is, in many ways, more featureful than libc despite also having zero dependencies. From my perspective, the main advantage of C is the way in which chip manufacturers only provide (poorly supported/bug-ridden) C compilers, but this is likely to become less important as ARM takes over more and more of the world: it is only getting easier and cheaper to throw a full ARM chip into a device, due to economies of scale.
- collyw 10y agoA load more developers as well?