-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
Description
Currently printf never sets errno, which is incorrect. The file variants should propogate errors from the file they're writing to and every variant should set EOVERFLOW
if the return value would overflow an int
. Currently the Writer
class stores the number of chars written as an int
, so it should be changed to something larger and probably unsigned. I'd recommend either size_t
or uint64_t
.
It's important to remember that errno should only be set in public functions before returning, not in internal helpers. The return value of printf_main
might need to be changed to be a struct with size_t
char count and an error code.