Changeset 33692 in vbox for trunk/include
- Timestamp:
- Nov 2, 2010 2:51:20 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67318
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cdefs.h
r33540 r33692 1141 1141 /** @def RT_FROM_MEMBER 1142 1142 * Convert a pointer to a structure member into a pointer to the structure. 1143 * 1143 1144 * @returns pointer to the structure. 1144 1145 * @param pMem Pointer to the member. … … 1147 1148 */ 1148 1149 #define RT_FROM_MEMBER(pMem, Type, Member) ( (Type *) ((uint8_t *)(void *)(pMem) - RT_UOFFSETOF(Type, Member)) ) 1150 1151 /** @def RT_FROM_CPP_MEMBER 1152 * Same as RT_FROM_MEMBER except it avoids the annoying g++ warnings about 1153 * invalid access to non-static data member of NULL object. 1154 * 1155 * @returns pointer to the structure. 1156 * @param pMem Pointer to the member. 1157 * @param Type Structure type. 1158 * @param Member Member name. 1159 * 1160 * @remarks Using the __builtin_offsetof does not shut up the compiler. 1161 */ 1162 #if defined(__GNUC__) && defined(__cplusplus) 1163 # define RT_FROM_CPP_MEMBER(pMem, Type, Member) \ 1164 ( (Type *) ((uintptr_t)(pMem) - (uintptr_t)&((Type *)0x1000)->Member + 0x1000U) ) 1165 #else 1166 # define RT_FROM_CPP_MEMBER(pMem, Type, Member) RT_FROM_MEMBER(pMem, Type, Member) 1167 #endif 1149 1168 1150 1169 /** @def RT_ELEMENTS
Note:
See TracChangeset
for help on using the changeset viewer.