[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13555: printf ignores length modifier
From: |
Paul Eggert |
Subject: |
bug#13555: printf ignores length modifier |
Date: |
Sat, 26 Jan 2013 08:37:42 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 |
On 01/26/2013 01:41 AM, Marcel Böhme wrote:
> $old/printf "%hi\n" 0xFFFF
> -1
> $printf "%hi\n" 0xFFFF
> 65535
None of these length modifiers are specified by POSIX,
so we're talking about what it's more useful for printf
to do, rather than whether this is a violation of
a standard. coreutils printf should agree
with Bash printf, and Bash printf ignores the modifiers,
so if we change coreutils we should change Bash too.
I suppose that 'printf' could change its behavior, and
use (say) 32-bit int for '%li' on a x86 but 64-bit int
on x86-64, thus exposing the native machine widths to
the user. However, for shell scripts I expect that more
people prefer portability to exposing the machine widths,
so the current behavior is better.