Is there any reason cobra shouldnt have support for hex literals similarly to what i,t does for integers decimals and floats?
Purely for user and readability convenience.
The reason I ask is that I was writing some bit bashing code and I'm unhappy with my role as a hex to int preprocessor for the compiler (:-)
Forums
Anyone for a Hex (literal)?
5 posts
• Page 1 of 1
Re: Anyone for a Hex (literal)?
Yeah, I have no opposition to a hex literal. Just never got around to it.
I wrote a long meandering response to this which I have replaced with conclusions:
hex literal: 0xA3FE
octal: 0o777
binary: 0b1101
So the prefix is a zero digit followed by the letter 'x', 'o' or 'b'. Always lower case. Give a nice error message if upper case is used.
I'd accept a patch that did all three (and included tests and IntermediateReleaseNotes.text).
I wrote a long meandering response to this which I have replaced with conclusions:
hex literal: 0xA3FE
octal: 0o777
binary: 0b1101
So the prefix is a zero digit followed by the letter 'x', 'o' or 'b'. Always lower case. Give a nice error message if upper case is used.
I'd accept a patch that did all three (and included tests and IntermediateReleaseNotes.text).
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: Anyone for a Hex (literal)?
Hoped so
You're sorta in luck - I got a patch for hex (0x syntax ) with test file and INtRelNotes -
didnt think about octal and binary ( though off the top of my head dont think octal is worth the effort - whos got a minicomputer these days)
I'll post what I've got when I get it cleaned and finish patch testing it.
Hmm binary ....
You're sorta in luck - I got a patch for hex (0x syntax ) with test file and INtRelNotes -
didnt think about octal and binary ( though off the top of my head dont think octal is worth the effort - whos got a minicomputer these days)
I'll post what I've got when I get it cleaned and finish patch testing it.
Hmm binary ....
- hopscc
- Posts: 632
- Location: New Plymouth, Taranaki, New Zealand
Re: Anyone for a Hex (literal)?
Heres the patch for HexLit
- Attachments
-
- HexLit.patch
- (6.11 KiB) Downloaded 647 times
- hopscc
- Posts: 632
- Location: New Plymouth, Taranaki, New Zealand
Re: Anyone for a Hex (literal)?
Latest has binary ( and octal shudder) support and allows use of _ separators.
- hopscc
- Posts: 632
- Location: New Plymouth, Taranaki, New Zealand
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 18 guests