[Moshe Zadka] > (Tidbit: since sizeof(long) measures in bytes, and %d prints in > decimals, then a buffer of length sizeof(long) is enough to hold > a decimal represntation of a long). [Greg Ewing] > Pardon? I think you're a bit out in your calculation there! > > 3*sizeof(long) should be enough, though (unless some weird C > implementation measures sizes in units of more than 8 bits). Getting closer, but the sign bit can consume a character all by itself, so 3*sizeof(long) sitll isn't enough. To do this correctly and minimally requires that we implement an arbitrary-precision log10 function, use the platform MIN/MIX #define's for longs and chars, and malloc the buffers at runtime. Note that instead I boosted the buffer sizes in the module from 80 to 250. That's obviously way more than enough for 64-bit platforms, and "obviously way more" is the correct thing to do for programmers <wink>. If one of the principled alternatives is ever checked in (be it an snprintf or /F's custom solution (which I like better)), we can go back and use those instead.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4