bug-gawk
[Top][All Lists]
Advanced

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

Re: gawk doesn't treat '018' as decimal 18


From: Jean-Philippe Guérard
Subject: Re: gawk doesn't treat '018' as decimal 18
Date: Sat, 9 Jan 2021 18:58:15 +0100

Le Sat, 9 Jan 2021 17:44:53 +0100, Arkadiusz Drabczyk a écrit :
> In gawk.info it says:
> 
> "Unlike in some early C implementations, '8' and '9' are not valid in
> octal constants.  For example, 'gawk' treats '018' as decimal 18:
> 
>      $ gawk 'BEGIN { print "021 is", 021 ; print 018 }'
>      -| 021 is 17
>      -| 18
> "
> 
> but I cannot reproduce it wit gawk built from today's master:
> 
> $ ./gawk 'BEGIN { print "021 is", 021 ; print 018 }'
> 021 is 17
> 0

As an additional curiosity, with today's master and the bignum option, I
get:

$ gawk -M 'BEGIN { print "021 is", 021 ; print 018 }'
021 is 17
1

Which is kind of logical (stops at the first non octal digit), but
also surprising.

-- 
Jean-Philippe Guérard
https://tigrerayé.org



reply via email to

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