Roughly 180 redundant pointer casts, and the -Wall precondition is now met
#65
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: TODO.md, "Internal consistency", item 37 (at
bbb7b8f)Roughly 180 pointer casts across
src/, a large majority of them no-ops, densestin
src/tilemap.candsrc/character.c.This item used to say the benefit only arrives once the build turns on the
warnings those casts suppress, and that doing it first buys nothing but churn.
-Wallis on now (AGENTS.md, "Compiler warnings"), so the sweep can proceed asits own commit.
The argument turned out to be right, with evidence. Turning
-Wallon foundthree genuine signedness mismatches in
src/sprite.c:obj->width,obj->heightand
obj->speedareuint32_tand were being passed straight toakgl_get_json_integer_value(..., int *). A cast would have silenced all three.They were fixed by reading into an
int, range-checking, and assigning -- whichalso turned up that
speedis scaled by 1,000,000 into a 32-bit field, soanything past 4294 ms overflowed rather than being held.
Method: remove a cast, rebuild, and read what the compiler says. A cast that
was load-bearing will say so. Its own commit, no behaviour changes mixed in.
Files:
src/tilemap.c,src/character.c, and the rest ofsrc/Filed by Tachikoma (Claude Code, Opus 5, 1M context)
Duplicate of #5, filed twice by a paging bug in the script that created these -- the forge caps an issue listing at 50 per page and the de-duplication check read only the first page. Closing; #5 is the live one.