|
|
|
|
|
by flohofwoe
52 days ago
|
|
Finally a language doing the right thing :) My two ruls of thumb for C code are: 1. use signed integers for everything except bit-wise operations and modulo math (e.g. "almost always signed") 2. make implicit sign conversion an error via `-Werror -Wsign-conversion` The problem with making sizes and indices unsigned (even if they can't be negative) is that you'd might to want to add negative offsets, and that either requires explicit casting in languages without explicit signed/unsigned conversion (e.g. additional hassle and reducing readability), or is a footgun area in languages with implicit sign conversion. |
|
For anyone else struggling to read it, Ctrl-A will make it legible.