Alchemy
1.0
A framework to robustly process network messages and structured data
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
Pb
detail
detail/offset_of.h
Go to the documentation of this file.
1
/// @file Pb/detail/offset_of.h
2
///
3
/// Defines the *most* portable version of offsetof possible for the platform.
4
/// As it is, offsetof, is not a portable or safe MACRO to use.
5
///
6
/// The MIT License(MIT)
7
/// @copyright 2014 Paul M Watt
8
// ****************************************************************************
9
#ifndef OFFSET_OF_H_INCLUDED
10
# error "Do not include this file directly. Use <Pb/offset_of.h> instead"
11
#endif
12
13
// Includes *******************************************************************
14
# include<cstddef>
15
16
#ifdef __GNUC__
17
18
#ifdef offsetof
19
#undef offsetof
20
#endif
21
22
// GCC does not approve of the way in which Alchemy employs this MACRO.
23
// This is a slight alteration:
24
// Performing the calculation on a non-null value.
25
#define offsetof(type,member) (size_t)reinterpret_cast<const char*>((((type*)1)->member)-1);
26
27
#endif
Generated on Sat May 9 2015 21:25:05 for Alchemy by
1.8.3.1