View mode: basic / threaded / horizontal-split · Log in · Help
January 15, 2007
pointer aliasing in D

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).
Top | Discussion index | About this forum | D home