What are the pointer aliasing rules in D?

tmp imranuvin07 at gmail.com
Thu Mar 6 10:46:20 UTC 2025


I come from a C/C++ background where the pointer aliasing rules 
make an assumption that pointers to different types cannot alias 
each other (with the exception of a pointer to char). This is 
known as the strict aliasing rule and while it can increase 
optimizations it makes it quite hard to write some low level code 
such as allocators or writing efficient memory copying functions.

Do the same rules exist in D? If they do, do workarounds exist?


More information about the Digitalmars-d-learn mailing list