__unaligned
When a pointer is declared as __unaligned, the compiler assumes that the type or data pointed to is not aligned. __unaligned is only valid in compilers for x64 and the Itanium Processor Family (IPF).
Remarks
When declaring a pointer to a structure that may not have aligned data, you can use the __unaligned keyword to tell the compiler that the type must be read one byte at a time.
By default, pointers are aligned.
For more information about alignment, see,
Structure Alignment Examples (x64 specific)
Example
// unaligned_keyword.cpp
// compile with: /c
// processor: x64 IPF
#include <stdio.h>
int main() {
char buf[100];
int __unaligned *p1 = (int*)(&buf[37]);
int *p2 = (int *)p1;
*p1 = 0; // ok
__try {
*p2 = 0; // throws an exception
}
__except(1) {
puts("exception");
}
}