mirror of
https://github.com/gbdev/rgbds.git
synced 2026-09-22 05:37:08 +00:00
Interestingly, Clang's `-Wformat-overflow` seems to only warn about buffers so small they will *always* underflow, whereas GCC tries to infer whether they can overflow *at all*. (I'm guessing they lean towards false-negatives and false-positives resp.) Anyway, calling `sprintf` here remains safe, since GCC (notably, via CI) checks our work, and it simplifies the code ever so slightly while also providing an (admittedly negligible) performance improvement. Note that there may be more locations where we could use `sprintf`, but a cursory glance at our other uses of `snprintf` didn't seem fruitful. (One way to test is to set the target buffer size to 1, and see if a warning pops up for such a trivially-wrong size. If not, you can be certain the compiler won't be able to help you with a more realistic size.)