2 ms·
I'd say there's no issue with writing such code, so long as it's protected by a compile-time assertion. That said, if you use a variable-width integer type (`c
by SAI_Peregrinus 3y ago
I'd say there's no issue with writing such code, so long as it's protected by a compile-time assertion.
That said, if you use a variable-width integer type (`char`, `short`, `int`, `long`, `long long`) instead of a fixed-width type (`int32_t` & such) for anything other than passing parameters to existing libraries (including the standard library) I'd say you're Doing It Wrong. If you actually intend to have a variable-width, use one of the `_least` or `_fast` types to make it clear that you didn't just screw up.
- NikkiA 3y agoOne thing I think C++ (or at least, most C++ users) gets right is suggesting that you should use 'auto' if you don't really care that much about bit width, and the specified sizes otherwise. Thankfully C23 takes this approach, although it'll probably take forever until it's as adopted as widespread as C99 is now, and that's still not widespread enough.