data mapping, more elegant solution?

mandel oh at no.es
Thu Dec 13 05:43:51 PST 2007


On Thu, 13 Dec 2007 13:35:35 +0000, Regan Heath wrote:
> Use a union?
> 
> union thing
> {
>    ubyte[8] ub;
>    uint     ui;
> }
> 
> void main()
> {
>    thing a;
>    a.ui = 42;
> }
> 
This way I can't insert data at arbitrary places, e.g. array[4..8].
I also would have to cast thing to ubyte[8] when I pass it to functions.
It's also hackish. :P


More information about the Digitalmars-d-learn mailing list