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

Re: rethinking printf

Thread Previous | Thread Next
From:
sthoenna
Date:
March 7, 2002 01:06
Subject:
Re: rethinking printf
Message ID:
8kyh8gzkgieT092yn@efn.org
In article <20020306223747.G66626@farm.org>,
=?koi8-r?B?RG1pdHJ5IEtvaG1hbnl1ayDkzcnU0snKIOvPyM3BzsDL?= <dk+fwp@farm.org> wrote:
>On Wed, Mar 06, 2002 at 08:56:18PM -0800, Yitzchak Scott-Thoennes wrote:
>> >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.
>
>	this is section *1* manual, for commands, right?  

Whoops.  Didn't notice the section number, my apologies.

>	It's possible that printf *program* does that, but that's really weird.
>
>	(yes, indeed: printf(1) FreeBSD 3.5, Linux 2.2.14, and SunOS 5.8 aka Solaris 8 are
>	documented and work this way.)
>
>> POSIX (IEEE 1003.1-2001) says:
>> If the format is exhausted while arguments remain, the excess
>> arguments shall be evaluated but are otherwise ignored.

Above is obviously for printf(3).  For printf(1) it indeed says:
  9. The format operand shall be reused as often as necessary to
     satisfy the argument operands. Any extra c or s conversion
     specifiers shall be evaluated as if a null string argument were
     supplied; other extra conversion specifications shall be evaluated
     as if a zero argument were supplied. If the format operand
     contains no conversion specifications and argument operands are
     present, the results are unspecified.

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