Coda Distributed File System
lib-src
base
coda_offsetof.h
Go to the documentation of this file.
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) \
37
((size_t)(&(reinterpret_cast<type *>(__alignof__(type *)))->member) - \
38
__alignof__(type *))
39
40
#else
/* default should work most of the time but might get compile warnings */
41
#define coda_offsetof(type, member) offsetof(type, member)
42
#endif
43
44
#endif
/* _CODA_OFFSETOF_H_ */
Generated by
1.9.4