3 ms·
That’s just an aesthetic choice, and C doesn’t give you many options. Structs for the pointer and limit might be nice, but that wouldn’t be a huge improvement.
by db48x 4y ago
That’s just an aesthetic choice, and C doesn’t give you many options. Structs for the pointer and limit might be nice, but that wouldn’t be a huge improvement.
The truth is that this isn’t really a “common” function; most programs will call it (or one of its siblings) just a few times for input and output. You’re write that code once and then never worry about it again.
Leaving all that aside, if you think you can do better, feel free to write a wrapper library and prove it.