[PD] makefilename inconsistency (or not?)

Matteo Sisti Sette matteosistisette at gmail.com
Wed Dec 9 18:41:07 CET 2009


Hans-Christoph Steiner escribió:
> 
> What does printf do?  It probably should mimic that behavior.

I think it should mimic sprintf's behaviour to be precise.
I don't know what it is but I dubt it can leave the string (a pointer to 
which is passed as parameter) unmodified.

The funny thing is the documentation (if this 
http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/ is a 
reliable reference) is not very explicit about that.
It says the function can "fail" (which is the only case in which it 
would be acceptable "not to output anything"), but does not specify when:

"Return Value
On success, the total number of characters written is returned. This 
count does not include the additional null-character automatically 
appended at the end of the string.
On failure, a negative number is returned."

There are a few "should be" in the description. If we take those "should 
be" as the conditions that determine success or failure, a 0 precision 
is not a failure condition, so according to the definition it should 
just output a 0-length string.



-- 
Matteo Sisti Sette
matteosistisette at gmail.com
http://www.matteosistisette.com




More information about the Pd-list mailing list