3 ms·
This is just pretty bad design, and it means if char is 16 bits and so is int, which as far as I can tell is allowed, the interface is unusable.
by tinus_hn 4y ago
This is just pretty bad design, and it means if char is 16 bits and so is int, which as far as I can tell is allowed, the interface is unusable.
- kevin_thibedeau 4y agoThe systems where this is the case aren't intended for text processing.
- anonymoushn 4y agothis doesn't mean that fwrite should only write every 2nd or every 4th byte, when you give it a pointer to some non-text data
- asveikau 4y agoYou've just illustrated one of the reasons I wrote that it would be crazy town to make such a choice. The C standard and POSIX are full of things like this. Areas where an implementation could make different choices, but actually making certain choices would be very foolish, so by and large people do not. Re-reading the article, it seems like Texas Instruments has made such a choice. I think it'd be quite challenging to find others. Edit: i found this documentation from TI confirming this. https://www.ti.com/document-viewer/lit/html/SPRAC71A/GUID-3FF7C096-6819-499B-B1F7-629908E57DE6#TITLE-SPRAC71SPRAB896205 https://www.ti.com/document-viewer/lit/html/SPRAC71A/GUID-3F... "There are no 8-bit objects on C28x devices. This presents unique challenges for implementing the ELF object file format on C28x devices." Int is also 16 bits.
- theamk 4y agoThere is a whole world of those systems, those are usually called "DSP", and TI is just one example of those. Basically, microprocessors optimized at math operations and lower cost, at the expense of compatibility. I have programmed them in the past, and yeah, you have to thread carefully. Many existing libraries are nor ready for the wide chars.