npf_(v)snprintf return negative values #248
-
Is it possible for npf_(v)snprintf to ever return a negative value. Indicating some kind of internal error. I've tried to read the code and can't find any path where a negative value is returned. npf_ftoa_rev() returns negative values, but that seems only to be a trick to mark if inf_or_nan was found and the return value is later inverted to positive again. A topic of the return value in README.md would be good. Much like man-pages usually have a RETURN VALUE section. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hi @Gozem - nanoprintf is intended to be a drop-in replacement for (v)snprintf, so it matches the return codes of the standard library functions. Specifically, from https://en.cppreference.com/w/c/io/fprintf: Section 4 above describes the return values that snprintf can return. (vsnprintf is similar but found over here: https://en.cppreference.com/w/c/io/vfprintf). Because nanoprintf does not deal with This is good feedback, though, so thanks! I'll add an issue to the tracker to make this explicit in the README.md, and also in the header file itself. |
Beta Was this translation helpful? Give feedback.
-
Filed #249 for the docs. It should be quick + small; I'll try to get to it soon! |
Beta Was this translation helpful? Give feedback.
-
Readme and .h file both now discuss the return values of the |
Beta Was this translation helpful? Give feedback.
Readme and .h file both now discuss the return values of the
npf_
functions. #249