summaryrefslogtreecommitdiff
path: root/src/stdafx.h
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2020-12-14 00:22:04 +0100
committerMichael Lutz <michi@icosahedron.de>2021-02-13 20:08:53 +0100
commit84636fc2af4dfc77b43479909273ebadb4f9b7cb (patch)
treea4e33da78ab32008675bef8df22e9ca6a2ffcf1a /src/stdafx.h
parent7845434270524d4c777a6711d2e17ac89eeeeb89 (diff)
downloadopenttd-84636fc2af4dfc77b43479909273ebadb4f9b7cb.tar.xz
Codechange: Remove all remaining uses of cpp_offset.
Diffstat (limited to 'src/stdafx.h')
-rw-r--r--src/stdafx.h7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/stdafx.h b/src/stdafx.h
index e5cb9205f..7ee3ce204 100644
--- a/src/stdafx.h
+++ b/src/stdafx.h
@@ -392,18 +392,13 @@ static_assert(SIZE_MAX >= UINT32_MAX);
*/
#define lastof(x) (&x[lengthof(x) - 1])
-#define cpp_offsetof(s, m) (((size_t)&reinterpret_cast<const volatile char&>((((s*)(char*)8)->m))) - 8)
-#if !defined(offsetof)
-# define offsetof(s, m) cpp_offsetof(s, m)
-#endif /* offsetof */
-
/**
* Gets the size of a variable within a class.
* @param base The class the variable is in.
* @param variable The variable to get the size of.
* @return the size of the variable
*/
-#define cpp_sizeof(base, variable) (sizeof(((base*)8)->variable))
+#define cpp_sizeof(base, variable) (sizeof(std::declval<base>().variable))
/**
* Gets the length of an array variable within a class.