[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Undocumented usage of printf?
From: |
Clark J. Wang |
Subject: |
Re: Undocumented usage of printf? |
Date: |
Fri, 16 Apr 2010 09:36:37 +0800 |
On Thu, Apr 15, 2010 at 11:43 PM, Eric Blake <eblake@redhat.com> wrote:
> On 04/15/2010 08:21 AM, Clark J. Wang wrote:
> > I saw a printf usage from a Linux forum's post:
> >
> > # printf "%d\n" "'a"
> > 97
> > #
>
> POSIX requires this behavior, so you could claim that this serves as
> documentation:
> http://www.opengroup.org/onlinepubs/9699919799/utilities/printf.html
>
> "If the leading character is a single-quote or double-quote, the value
> shall be the numeric value in the underlying codeset of the character
> following the single-quote or double-quote."
>
> Thank you. I've never read the POSIX standards so carefully. :)
> --
> Eric Blake eblake@redhat.com +1-801-349-2682
> Libvirt virtualization library http://libvirt.org
>
>