[PD] makefilename inconsistency (or not?)

Hans-Christoph Steiner hans at at.or.at
Fri Dec 11 06:13:20 CET 2009


On Dec 9, 2009, at 12:41 PM, Matteo Sisti Sette wrote:

> 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.


Just write a tiny C program to test what sprintf() actually does.

.hc



----------------------------------------------------------------------------

You can't steal a gift. Bird gave the world his music, and if you can  
hear it, you can have it. - Dizzy Gillespie







More information about the Pd-list mailing list