3 ms·
For all its advantages, C is unfortunately so ripe with stuff that any sane guideline would recommend not to do that it can hard to follow through. Though I ag
by cultureswitch 4y ago
For all its advantages, C is unfortunately so ripe with stuff that any sane guideline would recommend not to do that it can hard to follow through.
Though I agree in this case this would never have passed a modern review.
- Joker_vD 4y agoThere is a lovely piece of text in the third version of PNG specification: "PNG four-byte unsigned integers are limited to the range 0 to 2^31-1 to accommodate languages that have difficulty with unsigned four-byte values" [0]. Gee, I wonder what languages those may be? [0] https://www.w3.org/TR/2022/WD-png-3-20221025/#7Integers-and-byte-order https://www.w3.org/TR/2022/WD-png-3-20221025/#7Integers-and-...
- account42 4y agoThe answer is Java, not C(++).
- dahfizz 4y agoC has no problem dealing with a uint32_t. Not sure what you are getting at. This is more of an issue with languages like java that abstract away integer widths and signs, which is convenient if you're only doing arithmetic but becomes a huge pain when dealing with binary data.
- pjmlp 4y agoOne only needs to compare C programming manuals with the programming manuals from systems programming languages being developed outside Bell Labs. Also note that C author's were naturally aware of these issues and created lint in 1979. Now getting people to use such tooling is another matter, apparently 50 years weren't enough.