VirtualBox

Changeset 5104

Show
Ignore:
Timestamp:
09/28/07 19:14:52 (1 year ago)
Author:
vboxsync
Message:

RT_UOFFSETOF

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/iprt/cdefs.h

    r4852 r5104  
    804804 
    805805/** @def RT_OFFSETOF 
    806  * Our own special offsetof() variant
     806 * Our own special offsetof() variant, returns a signed result
    807807 * 
    808808 * This differs from the usual offsetof() in that it's not relying on builtin 
     
    811811 * with a variable length field. 
    812812 * 
    813  * @returns offset into the structure of the specified member. 
     813 * @returns offset into the structure of the specified member. signed. 
    814814 * @param   type    Structure type. 
    815815 * @param   member  Member. 
    816816 */ 
    817817#define RT_OFFSETOF(type, member)   ( (int)(uintptr_t)&( ((type *)(void *)0)->member) ) 
     818 
     819/** @def RT_UOFFSETOF 
     820 * Our own special offsetof() variant, returns an unsigned result. 
     821 * 
     822 * This differs from the usual offsetof() in that it's not relying on builtin 
     823 * compiler stuff and thus can use variables in arrays the structure may 
     824 * contain. If in this usful to determin the sizes of structures ending 
     825 * with a variable length field. 
     826 * 
     827 * @returns offset into the structure of the specified member. unsigned. 
     828 * @param   type    Structure type. 
     829 * @param   member  Member. 
     830 */ 
     831#define RT_UOFFSETOF(type, member)   ( (uintptr_t)&( ((type *)(void *)0)->member) ) 
    818832 
    819833/** @def RT_SIZEOFMEMB 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy