public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* gawk: regression with unary plus
@ 2018-02-04 22:59 Steven Penny
  2018-02-05 12:05 ` Houder
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Penny @ 2018-02-04 22:59 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gawk: regression with unary plus
  2018-02-04 22:59 gawk: regression with unary plus Steven Penny
@ 2018-02-05 12:05 ` Houder
  2018-02-05 12:26   ` Corinna Vinschen
  0 siblings, 1 reply; 3+ messages in thread
From: Houder @ 2018-02-05 12:05 UTC (permalink / raw)
  To: cygwin

On Sun, 04 Feb 2018 14:59:30, Steven Penny wrote:
> Previously conversions could be triggered by either adding zero (+0), unary
> plus (+) or unary minus (-) [1]:
[snip]

> However now conversion only happens with adding zero and unary minus:
[snip]

> Does anyone know where this change was mentioned or why it was done?
> 
> [1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html

For those who are interested:

    https://unix.stackexchange.com/questions/421904/regression-with-unary-plus
    (Regression with unary plus, by Steven Penny)

As suggested by Stéphane Chazelas in his response, the change in behaviour is
problably not intentional.

Modifying (i.e. extend it) the '0p_unary_plus CASE' in interpret.h, restores
the previous behaviour.

Henri


--
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gawk: regression with unary plus
  2018-02-05 12:05 ` Houder
@ 2018-02-05 12:26   ` Corinna Vinschen
  0 siblings, 0 replies; 3+ messages in thread
From: Corinna Vinschen @ 2018-02-05 12:26 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1093 bytes --]

On Feb  5 13:05, Houder wrote:
> On Sun, 04 Feb 2018 14:59:30, Steven Penny wrote:
> > Previously conversions could be triggered by either adding zero (+0), unary
> > plus (+) or unary minus (-) [1]:
> [snip]
> 
> > However now conversion only happens with adding zero and unary minus:
> [snip]
> 
> > Does anyone know where this change was mentioned or why it was done?
> > 
> > [1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
> 
> For those who are interested:
> 
>     https://unix.stackexchange.com/questions/421904/regression-with-unary-plus
>     (Regression with unary plus, by Steven Penny)
> 
> As suggested by Stéphane Chazelas in his response, the change in behaviour is
> problably not intentional.
> 
> Modifying (i.e. extend it) the '0p_unary_plus CASE' in interpret.h, restores
> the previous behaviour.
> 
> Henri

I forwarded this to the gawk devel ML.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-05 12:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-04 22:59 gawk: regression with unary plus Steven Penny
2018-02-05 12:05 ` Houder
2018-02-05 12:26   ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).