ATL的offsetofclass中,為啥_ATL_PACKING是8的解釋
解答出處
?
C++標準規定:
編譯器的類的類型轉換對空指針(NULL)特殊處理,即你NULL進行強制類型轉化的結果還是NULL,所以….
static_cast類型轉化的時候,_ATL_PACKING的值得是非零就好
?
C++ Standard 4.10/3 Pointer conversions [conv.ptr]:
An rvalue of type “pointer to cv D,” where D is a class type, can be converted to an rvalue of type “pointer to cv B,” where B is a base class (clause 10) of D. If B is an inaccessible (clause 11) or ambiguous (10.2) base class of D, a program that necessitates this conversion is ill-formed. The result of the conversion is a pointer to the base class sub-object of the derived class object. The null pointer value is converted to the null pointer value of the destination type.
posted on 2012-01-12 13:52 __ay 閱讀(1972) 評論(1) 編輯 收藏 引用 所屬分類: 算法 && C/C++

