Web lists-archives.com

gawk: regression with unary plus




Previously conversions could be triggered by either adding zero (+0), unary
plus (+) or unary minus (-) [1]:

   $ gawk --version
   GNU Awk 4.1.4, API: 1.1 (GNU MPFR 3.1.6-p1, GNU MP 6.1.2)

   $ ./gawk 'BEGIN {print "01" + 0}'
   1

   $ ./gawk 'BEGIN {print +"01"}'
   1

   $ ./gawk 'BEGIN {print -"01"}'
   -1

However now conversion only happens with adding zero and unary minus:

   $ gawk --version
   GNU Awk 4.2.0, API: 2.0 (GNU MPFR 3.1.6-p1, GNU MP 6.1.2)

   $ gawk 'BEGIN {print "01" + 0}'
   1

   $ gawk 'BEGIN {print +"01"}'
   01

   $ gawk 'BEGIN {print -"01"}'
   -1

Does anyone know where this change was mentioned or why it was done?

[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple