Re:Show HN: Super Simple CRC32 Implementation
by epcoa on Sunday November 03, 2024 @09:44AM
(#42033328)
Fair enough (though a Unisys 2200 might be a stronger example, people still use them, but neither support C99 AFAIK). But by “break” here, it's only fair to point out, if such a compiler even existed, it would have the property of definitely failing with an error at compile time for uint32_t not existing, it’s not going to compile and overflow at runtime. (And yes you will practically get a warning with the pasted code, and shame on anyone for not using -Werror, but pedantically this isn't even guaranteed sadly enough). They are completely different classes of portability defects and only one is a correctness issue.
Setting aside whether there is even a C99 compiler for anything Symbolics, or anything where uint32_t doesn’t exist (already assuming C99 or above here). Is there? Meanwhile there are a few existing supported gcc architectures where sizeof int == 2.
Pick what level of pragmatism you prefer I guess. I prefer avoiding the standard integer types unless I can comfortably fit in their guaranteed sizes. I don’t really care about obsolete machines that will never have a C99 compiler outside a novelty.
Re:Show HN: Super Simple CRC32 Implementation
by jart on Sunday November 03, 2024 @11:05AM
(#42033805)
> I don’t really care about obsolete machines that will never have a C99 compiler outside a novelty.
And you know what? I don't care about people who use C on 16-bit computers, unless I'm being paid to.
I've written plenty of assembly they can consume, like https://justine.lol/sectorlisp2/
Re:Show HN: Super Simple CRC32 Implementation
by epcoa on Sunday November 03, 2024 @11:20AM
(#42033912)
Not sure why you're so triggered. I didn't even say you were wrong or anything. I originally thought the more pressing issue is filling half a table up with 0s. It's some idle commentary on a piece of code in a comment, relax?
Your suggestion will break on that.
We clearly want uint_least32_t.