"Fossies" - the Fresh Open Source Software Archive

Member "coda-6.9.5/lib-src/base/coda_offsetof.h" (9 Aug 2005, 1250 Bytes) of package /linux/misc/old/coda-6.9.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "coda_offsetof.h" see the Fossies "Dox" file reference documentation.

    1 /* BLURB lgpl
    2 
    3                            Coda File System
    4                               Release 6
    5 
    6           Copyright (c) 1987-2003 Carnegie Mellon University
    7                   Additional copyrights listed below
    8 
    9 This  code  is  distributed "AS IS" without warranty of any kind under
   10 the  terms of the  GNU  Library General Public Licence  Version 2,  as
   11 shown in the file LICENSE. The technical and financial contributors to
   12 Coda are listed in the file CREDITS.
   13 
   14                         Additional copyrights
   15                            none currently
   16 
   17 #*/
   18 
   19 #ifndef _CODA_OFFSETOF_H_
   20 #define _CODA_OFFSETOF_H_
   21 
   22 #ifdef HAVE_CONFIG_H
   23 #include "config.h"
   24 #endif
   25 
   26 #include <sys/types.h>
   27 #include <stddef.h>
   28 
   29 #if defined(CODA_OFFSETOF_OFFSETOF)
   30 #define coda_offsetof(type,member) offsetof(type,member)
   31 
   32 #elif defined(CODA_OFFSETOF_PTR_TO_MEMBER)
   33 #define coda_offsetof(type,member) ((size_t)(&type::member))
   34 
   35 #elif defined(CODA_OFFSETOF_REINTERPRET_CAST)
   36 #define coda_offsetof(type,member) ((size_t)(&(reinterpret_cast<type*>(__alignof__(type*)))->member)-__alignof__(type*))
   37 
   38 #else /* default should work most of the time but might get compile warnings */
   39 #define coda_offsetof(type,member) offsetof(type,member)
   40 #endif
   41 
   42 #endif /* _CODA_OFFSETOF_H_ */
   43