Leadings zeroes signal the use of base 8. Have a look at this “base 10” 
calculator.

 

https://play.golang.org/p/L0whPekuvG

 

There was debate about this in early Go days. It is consistent with historical 
usage (C, and earlier, in Donald Knuth’s Art of Computer Programming.) Good 
summary at Wikipedia (https://en.wikipedia.org/wiki/Octal#In_computers) and in 
this 2009 Go decision (https://github.com/golang/go/issues/151).

 

 

From: <golang-nuts@googlegroups.com> on behalf of Val <delepl...@gmail.com>
Date: Friday, August 19, 2016 at 9:40 PM
To: golang-nuts <golang-nuts@googlegroups.com>
Cc: <rthornton...@gmail.com>
Subject: Re: [go-nuts] Unary +

 

Hello Ian
Leading zeroes do affect the value : https://play.golang.org/p/h0iE_8_yYK
I personally regard this as a gotcha, and this feeling gets stronger when an 
experienced gopher overlooks it. I put an entry in my go-traps list.
Cheers
Val

On Saturday, August 20, 2016 at 2:55:44 AM UTC+2, Ian Lance Taylor wrote:


The same is true of leading zeroes, which also do not affect the value 
of the expression. 

Ian 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to