Thread overview | ||||||
---|---|---|---|---|---|---|
|
August 19, 2001 Octal integers | ||||
---|---|---|---|---|
| ||||
Folks, Please, please, don't indicate octal integers using a zero prefix. Leading zeros on numbers have no mathematical effect, and so should have no effect in a programming language. I've been burned at least three times by this "feature." Why don't you skip the 0123 for octal, 0x123 for hex, etc., and use some generic radix indicator? For example: 2'010101, 8'1234, 16'123ABC. ~~ Paul |
August 19, 2001 Re: Octal integers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paul Anagnostopoulos | Paul Anagnostopoulos wrote in message <9ln2th$18ti$1@digitaldaemon.com>... >Please, please, don't indicate octal integers using a zero prefix. Leading >zeros on numbers have no mathematical effect, and so should have no effect >in a programming language. I've been burned at least three times by this >"feature." >Why don't you skip the 0123 for octal, 0x123 for hex, etc., and use some >generic radix indicator? For example: 2'010101, 8'1234, 16'123ABC. I guess I'm just so used to the octal notation! |
August 19, 2001 Re: Octal integers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:9ln5hv$1a9h$1@digitaldaemon.com... > > Paul Anagnostopoulos wrote in message <9ln2th$18ti$1@digitaldaemon.com>... > >Please, please, don't indicate octal integers using a zero prefix. Leading > >zeros on numbers have no mathematical effect, and so should have no effect > >in a programming language. I've been burned at least three times by this > >"feature." > >Why don't you skip the 0123 for octal, 0x123 for hex, etc., and use some > >generic radix indicator? For example: 2'010101, 8'1234, 16'123ABC. > > > I guess I'm just so used to the octal notation! > I have a suggestion I've always thought about. I'm incredibly used to the common hex notation 0x## but the octal notation always threw me off the rare times I had to use it. I'm using it more and more these days for various projects, and I agree with Paul with not having octals denoted with a 0 prefix. I DO, however, think the hex way works well.. the leading 0 assures you it's an integer you're coding and the x points out, clear as day, that you're coding a hex number. Why not do something similar for octals? My first inkling is 0o##, o for octal, but admittedly that looks incredibly lame. Some other letter perhaps? Just a thought. -Brady |
August 19, 2001 Re: Octal integers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paul Anagnostopoulos | "Paul Anagnostopoulos" <paul@windfall.com> wrote in message news:9ln2th$18ti$1@digitaldaemon.com... > Folks, > Why don't you skip the 0123 for octal, 0x123 for hex, etc., and use some > generic radix indicator? For example: 2'010101, 8'1234, 16'123ABC. > I think ADA has something like that, can't remember the syntax tho' But really, I think it's tooo much typing! I knew 68K assembler before learning C and I remember it seemed to me unacceptable to use TWO characters "0x" just to type a hex number! ;-) (I used to think that hex should be the default base) --Luigi |
Copyright © 1999-2021 by the D Language Foundation