[glib] gmacros.h: offsetof is also available on MSVC
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gmacros.h: offsetof is also available on MSVC
- Date: Wed, 13 Jul 2016 03:45:11 +0000 (UTC)
commit 92e31896137c18434f599edcc5bb3729b2dd4e70
Author: Nirbheek Chauhan <nirbheek centricular com>
Date: Mon Jul 11 18:17:34 2016 +0530
gmacros.h: offsetof is also available on MSVC
All versions since Visual C++ 2005 have this available, so we can just
use it for G_STRUCT_OFFSET.
See: https://msdn.microsoft.com/en-us/library/dz4y9b9a.aspx
glib/gmacros.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 9113221..7583479 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -311,7 +311,7 @@
* fields through their offsets.
*/
-#if defined(__GNUC__) && __GNUC__ >= 4
+#if (defined(__GNUC__) && __GNUC__ >= 4) || defined (_MSC_VER)
#define G_STRUCT_OFFSET(struct_type, member) \
((glong) offsetof (struct_type, member))
#else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]