[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gawk] Handling hexadecimals in different modes
From: |
Jarno Suni |
Subject: |
[bug-gawk] Handling hexadecimals in different modes |
Date: |
Mon, 31 Aug 2015 22:56:18 +0300 |
gawk 'BEGIN{printf("%d\n", "0x15")}';
gawk -W non-decimal-data 'BEGIN{printf("%d\n", "0x15")}';
gawk -W traditional 'BEGIN{printf("%d\n", "0x15")}';
gawk -W posix 'BEGIN{printf("%d\n", "0x15")}';
(prints 0, 21, 0, 21, respectively)
I wonder why it works different way in traditional mode than in posix
mode. I didn't find it in documentation. I am going to write a script
that works the same way, no matter if gawk or mawk is the available awk
implementation.
These two
mawk -W non-decimal-data 'BEGIN{printf("%d\n", "0x15")}';
mawk -W posix 'BEGIN{printf("%d\n", "0x15")}';
work same way than with gawk (albeit a warning message with the first
command written to standard error).
--
Jarno Ilari Suni - http://www.iki.fi/8/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-gawk] Handling hexadecimals in different modes,
Jarno Suni <=