0xFF versus 0xff style

90 views
Skip to first unread message

Nigel Tao

unread,
Feb 8, 2010, 7:54:24 AM2/8/10
to golang-nuts
Possibly a little too pedantic, but should we just pick one style for
hexadecimal constants and make gofmt enforce it? Skimming src/pkg
suggests that the lower-case style is more popular.

Nigel Backhurst - I-E-A

unread,
Feb 8, 2010, 8:06:36 AM2/8/10
to golan...@googlegroups.com
Probably a good idea. Must say I find it a bit confusing at times to
have two different styles being used in the same piece of code. Would
prefer to have the uppercase form, 0xFF but as most people seem to be
using lowercase 0xff let's go with that as the standard. The less scope
for confusion there is the better.

Nigel

--
Nigel Backhurst MSc BA(Hons) FFA
Information Engineering Associates
14 Deacon Street
Leicester LE2 7EF

Jonathan Leffler

unread,
Feb 8, 2010, 11:52:52 AM2/8/10
to golang-nuts

On Feb 8, 5:06 am, Nigel Backhurst - I-E-A <ni...@i-e-a.eu> wrote:
> On 08/02/2010 12:54, Nigel Tao wrote:> Possibly a little too pedantic, but should we just pick one style for
> > hexadecimal constants and make gofmt enforce it? Skimming src/pkg
> > suggests that the lower-case style is more popular.
>
> Probably a good idea.  Must say I find it a bit confusing at times to
> have two different styles being used in the same piece of code.  Would
> prefer to have the uppercase form, 0xFF but as most people seem to be  
> using lowercase 0xff let's go with that as the standard.  The less scope
> for confusion there is the better.

I'd strongly advocate the 'all caps except the x' style. That way,
numbers are uniformly even height:

0x1234567890ABCDEF

instead of being up and down all over:

0x1234567890abcdef

Jonathan Leffler <jonathan...@gmail.com>

Reply all
Reply to author
Forward
0 new messages