get a struct member pointer

bearophile bearophileHUGS at lycos.com
Mon Feb 16 04:50:02 PST 2009


Daniel Keep:
> void lookup(T)(T[] s, size_t offset)
> {
>   char[] text = *cast(char[]*)(cast(void*)(&s[0]) + offset);
> }

I am learning still this topic, but can't this create an aliasing problem, as in C?
http://www.cellperformance.com/mike_acton/2006/06/understanding_strict_aliasing.html

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list