pointer aliasing in D

Sebastian Biallas groups.5.sepp at spamgourmet.com
Mon Jan 15 09:26:52 PST 2007


Hello,

Are there some pointer-aliasing contraints in D? Is there maybe some
similar like strict-aliasing in C?

Consider the following program:

struct S {
        int i;
};
struct T {
        int i;
};
void bar(S *a, T *b, S *c)
{
        b.i = a.i;
        c.i = a.i;
}

Since a and b are pointers of different types, a C compiler is allowed
to cache a.i in a register (the store to b.i must no change a.i).



More information about the Digitalmars-d mailing list