develooper Front page | perl.fwp | Postings from March 2002

Re: rethinking printf

Thread Previous | Thread Next
From:
sthoenna
Date:
March 6, 2002 21:15
Subject:
Re: rethinking printf
Message ID:
yLvh8gzkguDc092yn@efn.org
In article <p05100304b8aca0caa3ca@[192.168.254.205]>,
Rich Morin <rdm@cfcl.com> wrote:
>At 5:27 PM -0800 3/6/02, Yitzchak Scott-Thoennes wrote:
>>>    "The format string is reused as often as necessary
>>>     to satisfy the arguments."
>>
>>Where did you get that?  Not true for Perl or C.
>
>Apparently, when I did a "man printf", I got the one in FreeBSD's Section 1:
>>       The format string is reused as often as necessary to satisfy the
>>       arguments.  Any extra format specifications are evaluated with zero or
>>       the null string.

Thats funky.

POSIX (IEEE 1003.1-2001) says:
If the format is exhausted while arguments remain, the excess
arguments shall be evaluated but are otherwise ignored.

And C99 (ISO 9899-1999 section 7.19.6.1) says:
If the format is exhausted while arguments remain, the excess
arguments are evaluated (as always) but are otherwise ignored.

Does it in fact reuse the format on your system?

>I also think Fortran FORMAT statements acted this way, but it's been
>far too long for me to remember for sure...  In any case, it seems
>that it isn't a problem...

Yes, Fortran mostly works this way.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About