[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13555: printf ignores length modifier
From: |
Marcel Boehme |
Subject: |
bug#13555: printf ignores length modifier |
Date: |
Sun, 27 Jan 2013 08:55:26 +0800 |
Dear Paul,
Then, I suppose, the observed semantic change for the mentioned version pair
was _intended_. Found it odd that I didn't find documented that / why length
modifiers are 'suddenly' ignored.
Thanks for your follow-up!
Best regards,
Marcel
On 27 Jan, 2013, at 12:37 AM, Paul Eggert <address@hidden> wrote:
> 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.
>