C++中屏蔽offsetof告警的方法

来源:互联网 发布:俄罗斯方块知乎 编辑:程序博客网 时间:2024/05/01 12:17
-Wno-invalid-offsetof (C++ and Objective-C++ only)
Suppress warnings from applying the `offsetof' macro to a non-POD type. According to the 1998 ISO C++ standard, applying `offsetof' to a non-POD type is undefined. In existing C++ implementations, however, `offsetof' typically gives meaningful results even when applied to certain kinds of non-POD types. (Such as a simple `struct' that fails to be a POD type only by virtue of having a constructor.) This flag is for users who are aware that they are writing nonportable code and who have deliberately chosen to ignore the warning about it.

The restrictions on `offsetof' may be relaxed in a future version of the C++ standard.

原创粉丝点击