question on conversion specification implemented in newlib
Eric Blake
eblake@redhat.com
Wed May 9 13:43:00 GMT 2012
On 05/08/2012 03:20 AM, Can Finner wrote:
> Hi,
> I noticed that there is below sentence in C standard:
>
> Each conversion specification 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 flags (in any order)
> — An optional minimum field width.
> — An optional precision
> — An optional length modifier
> — A conversion specifier 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/newlib/attachments/20120509/5f3fff1a/attachment.sig>
More information about the Newlib
mailing list