www.digitalmars.com         C & C++   DMDScript  

D - Octal integers

reply "Paul Anagnostopoulos" <paul windfall.com> writes:
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
Aug 18 2001
next sibling parent reply "Walter" <walter digitalmars.com> writes:
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!
Aug 18 2001
parent "news.digitalmars.com" <bradeeoh crosswinds.net> writes:
"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 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. octal, but admittedly that looks incredibly lame. Some other letter perhaps? Just a thought. -Brady
Aug 18 2001
prev sibling parent "LuigiG" <ask.if iyou.need.it> writes:
"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
Aug 19 2001