www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - AccessUnalignedMemory version

It came up on this thread a few days ago
https://github.com/D-Programming-Language/phobos/pull/3916#issuecomment-171373707

Some architectures do not allow unaligned loads/writes.
It would be nice to have a Version for this:

version (AccessUnalignedMemory)
{
   foo(cast(ulong[])(ubyte)buffer));
}
else
{
   // copy in an aligned buffer and then call foo
}

Questions:
- Is it worth the addition ?
- Does anyone has a better naming suggestion ?
- Where should we put such a definition ?
Jan 16