warning C4366: The result of the unary '&' operator may be unaligned
来源:互联网 发布:人工智能计算器在线 编辑:程序博客网 时间:2024/05/21 00:56
warning C4366: The result of the unary '&' operator may be unaligned
这个错误的意思是取地址的对象不是内存对齐的,
比如
#pragma pack(1)
struct a
{
int a;
char b;
double c;
char d;
}
#pragma pack()
如果取结构体a的地址是没问题的,但是如果取结构体a中字段b的地址可能就有问题了,取地址c的话也有问题,因为内存中区地址有4字节或8字节对齐,64位系统或32位系统的地址对齐机制可能不一样。
所以如果出于数据安全需要严格按照单字节对齐,就不能取不对齐的字段的地址了,要取整个结构体的指针,然后用取字段赋值,或者偏移赋值来设置字段的值了。
0 0
- warning C4366: The result of the unary '&' operator may be unaligned
- Hint: This may be the result of an unspecified view, due to default view name generation.)]
- Python:WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable.
- msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsign
- Warning:Using incompatible plugins for the annotation processing: android-apt. This may result in an
- This may be due to a corruption of the heap
- This may be due to a corruption of the heap!
- the result of choice
- Warning: isrgb is obsolete and may be removed in the future
- Warning: bind(): React component methods may only be bound to the component instance. See ...
- How-To Find the Source of "Unaligned Access"
- The project 'FeiYueXueTang_Android' may be using a version of Gradle that does not contain the metho
- The Song: End of May
- This can be the result of a merge and the unknown UUID is being discarded.
- The operator of C++ : sizeof
- The configuration may be corrupt or incomplete
- _CRT_SECURE_NO_WARNINGS the function may be unsafe
- Use MFC in a Static Library,This may be due to a corruption of the heap....
- Redis configuration
- 使用JSF的<h:inputTextarea>组件中文乱码的问题
- CAN总线应用开发接口
- JAVA正则表达式 Pattern和Matcher
- 不容忽视的网络安全
- warning C4366: The result of the unary '&' operator may be unaligned
- 暴力推荐 Android Studio 中 ADBWIFI 插件
- 堆栈
- hdu1166解题报告
- $.ajax()方法详解
- VirtualBox中开启Linux的SSH(CentOS)
- 在JAVA中封装JSONUtils工具类及使用
- es java 查询空的数据字段
- onCreate()方法详解