bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gawk] Invalid result when converting to hex literal


From: Steven Penny
Subject: [bug-gawk] Invalid result when converting to hex literal
Date: Mon, 19 Mar 2018 19:35:47 -0700 (PDT)
User-agent: Tryst/2.4.0 (github.com/svnpenn/tryst)

Tested with Gawk 4.2.1 and 4.1.4. Hex literals work as expected:

   $ awk 'BEGIN {print 0x21}'
   33

   $ awk --posix 'BEGIN {print 0x21}'
   0

However when converting from string to hex literal, you get the opposite of what
is supposed to happen:

   $ awk 'BEGIN {print +"0x21"}'
   0

   $ awk --posix 'BEGIN {print +"0x21"}'
   33

in all examples, you should be getting "33" when not using POSIX. Note that all
Mawk versions work as expected.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]