4 ms·
It's quite amazing to see the degree of change; unfortunately, as C++ compilers are so integral to the system, shipping newer code for older platforms is provin
by zanchey 10y ago
It's quite amazing to see the degree of change; unfortunately, as C++ compilers are so integral to the system, shipping newer code for older platforms is proving quite difficult. We recently went to C++11 and have to drop binary builds (through OBS and PPA) for a number of still-maintained but older platforms, sadly.
- lallysingh 10y agoShame there isn't a 'C' target for modern C++ compilers.
- makapuf 10y agoSure, I like many of the new features of C++ that could be compatible with or adapted to C (constexpr, auto, typed enums, or even (gasp).. templates for generic programming) and I'm jealous of the level of innovation in C++ (which would't be that difficult to backport to C since the features already are on C++), especially for embedded.
- vopi181 10y agoWhy wouldn't you just use c++ then? Almost all c++ is valid C, no?
- astrodust 10y agoA lot of people write C in C++ mode just for convenience, you get things like const, but it's not the same as writing actual standards compliant C code. If you need portable C code, forget about all that stuff. Forget about a lot of things since some compilers are truly atrocious.
- khedoros1 10y agoAlmost all C is valid C++, but the reverse isn't true.
- makapuf 10y agoAlmost but not all. Restrict keyword, by example.
- dangerbird2 10y agoAlso modern features like atomics and complex numbers are implemented as language features in C, but with template libraries in C++. Likewise type-generic math in C11 uses the C-specific _Generic keyword, but uses templates and function overloading in C++
- Crespyl 10y agoDidn't there used to be an LLVM C backend? I think it's long since fallen into disrepair/bitrot, but it could probably be revived if there was enough demand.
- lallysingh 10y agoOh! I looked a bit and found https://github.com/JuliaComputing/llvm-cbe https://github.com/JuliaComputing/llvm-cbe, with its last commit a month ago.
- elcritch 10y agoThanks! This really should've been kept first class part of LLVM. It'd be a handy way to compile rust to various MCU architecture that llvm doesn't directly support.
- ris 10y agoThis sounds like it's more of a library thing than language thing. The problem (I'm guessing) is the older platforms have `libstdc++` which won't support newer features* . Though I suspect statically linking `libstdc++` might be a (nasty, but workable) option here. * - again, I'm guessing - I've been out of the c++ game for a few years...
- ash 10y agoFor those wondering, OBS: https://en.wikipedia.org/wiki/Open_Build_Service https://en.wikipedia.org/wiki/Open_Build_Service PPA: https://en.wikipedia.org/wiki/Personal_Package_Archive https://en.wikipedia.org/wiki/Personal_Package_Archive