This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question on conversion specification implemented in newlib


On 05/08/2012 03:20 AM, Can Finner wrote:
> Hi,
> I noticed that there is below sentence in C standard:
> 
> Each conversion speciïcation is introduced by the character %. After

Wow - I've never seen copy-and-paste insert 'fi' as a single UTF-8
ligature character before.

> the %, the following
> appear in sequence:
> â Zero or more ïags (in any order)
> â An optional minimum ïeld width.
> â An optional precision
> â An optional length modiïer
> â A conversion speciïer character
> 
> As quotes, the five kinds of character should appear in sequence, so
> it is undefined
> behavior if they are not in sequence?
> 
> I noticed that following codes works fine with newlib,
> fprintf(stdout, "%*.*-d\n", 100, 10, 32);

This is unspecified behavior, so anything can happen.  It would be nicer
if fprintf failed with EINVAL, but that is not a requirement.

> 
> Any help? Thanks.

What help are you looking for?  Confirmation that your code is
unspecified, and that you got lucky that it happened to do what you
wanted?  A request to change newlib to behave the same as glibc?

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]