logo       
Bookmark and Share

Re: printf \xNNN: msg#00098

gnu.core-utils.bugs

Subject: Re: printf \xNNN

Jim Meyering <jim@xxxxxxxxxxxx> writes:

> I was surprised to see that according to POSIX,
>
> http://www.opengroup.org/onlinepubs/007904975/utilities/printf.html
>
> printf does not recognize hexadecimal constants:

Yes, and that's why my POSIX-related patch of yesterday
<http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00094.html>
changed "*p == 'x'" to "!posixly_correct && (*p == 'x')". (Hmm, sorry
about the redundant parentheses. :-)

> Hexadecimal character constants as defined in the ISO C standard are not
> recognized in the format operand because there is no consistent way to
> detect the end of the constant.

Yes, that's a problem.

> The current implementation is consistent (at least in this respect)
> with the one in bash's built-in printf command, so I think it's best
> to leave it the way it is, at least for the upcoming coreutils-5.0.
> What do you think?

There are good arguments both ways. I can certainly understand your
leaving it the way that it is.

However, I would document the incompatibility with C.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise