Mail Archives: djgpp-workers/2000/11/18/14:22:10
> Date: Sat, 18 Nov 2000 13:20:11 -0500
>
> > Not if we want to keep the existing behavior of putc, which only
> > returns EOF when the whole call should fail.
>
> If you're trying to call putc on a string and there's no space left in
> the string, yes, the putc call should fail. You are out of space.
But that would conflict with how snprintf should work: it should NOT
fail if it runs out of space. Instead, it needs to stop writing into
the (full) buffer, but should still count characters _produced by
doprnt, because it needs to return the number of characters that
_would_ have been written had the buffer been large enough. The
easiest way to do that is to hide the fact that the buffer overflowed
from _doprnt, and let it keep going.
- Raw text -