4 ms·
Unusual platforms like DSPs usually have specific (usually proprietary) toolchains. Why can't those platforms implement extensions to support 32-bit bytes? Why
by mastax 4y ago
Unusual platforms like DSPs usually have specific (usually proprietary) toolchains. Why can't those platforms implement extensions to support 32-bit bytes? Why must everyone else support them? In practice ~no C code is portable to machines with 32-bit bytes. That's okay! You don't choose a DSP to run general purpose code. You choose it to run DSP code, usually written for a specific purpose, often in assembly.
- quelsolaar 4y ago"Weird" platforms often do have their own tool-chains but they do have the ability to leverage LLVM, MISRA, and an array of common tools and analyses that exists for C. One of the reason we got new platforms like RISC-V is that today its possible to use existing OSS software to build a platform with a working OS and Development environment, that common basic libraries can be built for is that all this software is written in C and can be targeted towards a new platform.
- ErikCorry 4y agoWhat is the relevance of RiscV here? Not weird at all. I feel like you skipped part of the argument.
- gumby 4y agoThe point is that new exploration of the design space only works when there’s a familiar environment to build on. The old days of each architecture being its own hermetic environment are gone.
- saagarjha 4y agoOk here’s a concrete one, ARM is experimenting with a brand new CHERI implementation that throws out a lot of “obvious” things that are supposed to be true for pointers and integers. The only way this has been able to work is that the standard is flexible enough to let C(++) work here. Rust is getting breaking changes to support the platform.
- tialaramex 4y agoUnsurprisingly Rust can target Morello already but it comes at a performance penalty. Whereas C has myriad integer types for special purposes, Rust only has a pair - a signed and unsigned integer of the same size as pointers. Since on CHERI a pointer is a different size from an address, Rust pays the price of using a 128-bit integer (to store pointers) as its array index. The potential change would make these types address-sized, so you can't fit a whole pointer in them on Morello where the pointer isn't just an address. On other platforms this change makes no practical difference.
- bumblebritches5 4y ago
- asojfdowgh 4y agodoesn't LLVM only cover a smidge of the weird platforms, if that? Like, it doesn't even cover ESP32 chips, despite attempts to get support into LLVM since 2019. point being, they can't leverage LLVM
- AdamH12113 4y agoBecause C already does this, and has from the beginning. C was designed to be portable in an era where there were significant differences in fundamental CPU design decisions between platforms. C is widely used to write software for all kinds of weird platforms. Changing that would be far more work than just making a new language.
- deleted 4y ago[deleted]
- rcxdude 4y agoThey also tend to be non-standard for a variety of reasons anyway! C bends backwards to support odd architectures but is often also insufficient (or at least the vendors cannot justify the effort to achieve full compliance and their customers don't care significantly anyway).