[cfe-dev] [RFC] Implement code generation for __unaligned

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Fri Feb 17 09:47:32 PST 2017


I don't think we want __unaligned to affect record layout, we just want it
to affect the alignment used when loading and storing an unaligned type.
That's the way I read the MSDN description of __unaligned. I don't think
Clang should implement its own, different semantics from MSVC for
__unaligned. That causes confusion and the compatibility issues you mention.

I think programmers already have enough tools to control record layout.
They have __attribute__((packed)) and __attribute__((aligned(N))). What
they don't have are good tools to take unaligned pointers from code they
don't control and access them safely. The MSVC version of __unaligned lets
you do that, so I think we should just finish implementing it as described
and call it a day.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170217/2d8abed5/attachment.html>


More information about the cfe-dev mailing list