enum ubyte[] vs enum ubyte[3]
Johannes Pfau
spam at example.com
Mon Dec 20 02:19:53 PST 2010
At 20.12.2010, 11:02, bearophile wrote <bearophileHUGS at lycos.com>:
>
> Hello Johannes and thank you for developing your tool for D2 too :-)
>
Actually it's not mine, I'm just a regular user. I don't think I could
ever understand the finite state machine code (especially because it's
c++), but patching the c/d1 codegen to output d2 code is easy enough ;-)
> In D1 a enum ubyte[] is a compile-time constant dynamic array of
> unsigned bytes, it is a 2 word long struct that contains a pointer and a
> length.
Did you mean in D2? I feared that, so I'll have to do some extra work...
> In D2 a "enum ubyte[30]" is a compile-time constant fixed size array of
> 32 unsigned bytes that gets passed around by value.
Yep, that's what I want.
>
> Regardless the array kind you want to use, also take a look at "Hex
> Strings":
> http://www.digitalmars.com/d/2.0/lex.html
> That allow you to write bytes arrays as hex data:
> x"00 FBCD 32FD 0A"
That's interesting, I'll have a look at it, but ragel shares big parts of
the c/c++/d code, so as long as the C syntax works there's no need to
change that.
>
> Bye,
> bearophile
Thanks for your help!
--
Johannes Pfau
More information about the Digitalmars-d-learn
mailing list