digitalmars.D.learn - hex strings
- Ellery Newcomer <ellery-newcomer utulsa.edu> Jan 26 2011
- Jonathan M Davis <jmdavisProg gmx.com> Jan 26 2011
- bearophile <bearophileHUGS lycos.com> Jan 26 2011
- Ellery Newcomer <ellery-newcomer utulsa.edu> Jan 26 2011
- Jonathan M Davis <jmdavisProg gmx.com> Jan 26 2011
- "Simen kjaeraas" <simen.kjaras gmail.com> Jan 26 2011
- Ellery Newcomer <ellery-newcomer utulsa.edu> Jan 26 2011
- bearophile <bearophileHUGS lycos.com> Jan 26 2011
- Jonathan M Davis <jmdavisProg gmx.com> Jan 26 2011
- spir <denis.spir gmail.com> Jan 26 2011
- Ellery Newcomer <ellery-newcomer utulsa.edu> Jan 26 2011
- "Simen kjaeraas" <simen.kjaras gmail.com> Jan 26 2011
just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..."
Jan 26 2011
On Wednesday, January 26, 2011 10:25:29 Ellery Newcomer wrote:just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..."
That's legal? I thought that x went in front of hex literals, not strings. I wouldn't have thought that that code would compile, and I certainly have no clue what you're trying to do. So, I certainly don't fall in the category of anyone using it - regardless of whether it's meant to be a string or not. - Jonathan M Davis
Jan 26 2011
Jonathan M Davis:That's legal?
They are a part of D language, search for "Hex Strings" here: http://www.digitalmars.com/d/2.0/lex.html Bye, bearophile
Jan 26 2011
On 01/26/2011 01:35 PM, Jonathan M Davis wrote:On Wednesday, January 26, 2011 11:29:59 bearophile wrote:Jonathan M Davis:That's legal?
They are a part of D language, search for "Hex Strings" here: http://www.digitalmars.com/d/2.0/lex.html
It always seems like there's at least one more thing in the language that I have no idea is there... - Jonathan M Davis
helps to have written a D lexer or two. weren't you going to do that?
Jan 26 2011
On Wednesday, January 26, 2011 11:29:59 bearophile wrote:Jonathan M Davis:That's legal?
They are a part of D language, search for "Hex Strings" here: http://www.digitalmars.com/d/2.0/lex.html
It always seems like there's at least one more thing in the language that I have no idea is there... - Jonathan M Davis
Jan 26 2011
Ellery Newcomer <ellery-newcomer utulsa.edu> wrote:just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..."
Never used them, tbh. But shouldn't that be cast(ubyte[]) x"...".dup ? -- Simen
Jan 26 2011
On 01/26/2011 02:16 PM, Simen kjaeraas wrote:Ellery Newcomer <ellery-newcomer utulsa.edu> wrote:just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..."
Never used them, tbh. But shouldn't that be cast(ubyte[]) x"...".dup ?
yeah, strictly speaking. but that (or cast(immutable(ubyte[]))) would be even uglier.
Jan 26 2011
Simen kjaeraas:cast(ubyte[]) x"..."
Never used them, tbh. But shouldn't that be cast(ubyte[]) x"...".dup
Maybe it's to avoid such mistakes that C++ has const_cast separated from other casts. Bye, bearophile
Jan 26 2011
On Wednesday 26 January 2011 11:53:32 Ellery Newcomer wrote:On 01/26/2011 01:35 PM, Jonathan M Davis wrote:On Wednesday, January 26, 2011 11:29:59 bearophile wrote:Jonathan M Davis:That's legal?
They are a part of D language, search for "Hex Strings" here: http://www.digitalmars.com/d/2.0/lex.html
It always seems like there's at least one more thing in the language that I have no idea is there... - Jonathan M Davis
helps to have written a D lexer or two. weren't you going to do that?
I've been working on it off and on, but I've been busy enough that I haven't made as much progress on it as I'd like. Even so though, I might have already run into it there and totally forgot about it, because it's a feature that I've never used and have no use for. - Jonathan M Davis
Jan 26 2011
On 01/26/2011 07:25 PM, Ellery Newcomer wrote:just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..."
Super-nice for universal text. Anything you can't type in because of non-illimited keyboard size... Actually had a similar idea, except using in-string delimiters #...# instead of a prefix: "#xx xxx xxxx xxx#" Adds one char compared to D syntax, but allows partially hex-coded string: "blah #xx xxxx xxx# blah" Denis -- _________________ vita es estrany spir.wikidot.com
Jan 26 2011
On 01/26/2011 05:57 PM, spir wrote:On 01/26/2011 07:25 PM, Ellery Newcomer wrote:just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..."
Super-nice for universal text. Anything you can't type in because of non-illimited keyboard size... Actually had a similar idea, except using in-string delimiters #...# instead of a prefix: "#xx xxx xxxx xxx#" Adds one char compared to D syntax, but allows partially hex-coded string: "blah #xx xxxx xxx# blah" Denis
personally, I always use \uxxxx or \Uxxxxxxxx [and then print it out to the console, copy it, and paste it back into my code]
Jan 26 2011
spir <denis.spir gmail.com> wrote:Adds one char compared to D syntax, but allows partially hex-coded string: "blah #xx xxxx xxx# blah"
I like having the ability to embed #'s in my strings, thank you. -- Simen
Jan 26 2011









Ellery Newcomer <ellery-newcomer utulsa.edu> 