summaryrefslogtreecommitdiffstats
path: root/generic/tk.h
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-06-15 20:42:53 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-06-15 20:42:53 (GMT)
commit266c86b993b37da2c483b238e67902daa375532f (patch)
tree37b46beac638336b84f19ff86de84cede74e4a04 /generic/tk.h
parent4e0f2e932c49f1910a446374f803f1a7cdf82020 (diff)
parent3bf66eee9133ac628425b0b83043f65da1f6f8ac (diff)
downloadtk-266c86b993b37da2c483b238e67902daa375532f.zip
tk-266c86b993b37da2c483b238e67902daa375532f.tar.gz
tk-266c86b993b37da2c483b238e67902daa375532f.tar.bz2
Define offsetof() macro for (very rare) platforms which don't have it. Don't punish developers for using offsetof() in extensions, forgetting that ...
Diffstat (limited to 'generic/tk.h')
-rw-r--r--generic/tk.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tk.h b/generic/tk.h
index 9312235..d5f876e 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -266,10 +266,10 @@ typedef struct Tk_ObjCustomOption {
* Computes number of bytes from beginning of structure to a given field.
*/
-#ifdef offsetof
#define Tk_Offset(type, field) ((int) offsetof(type, field))
-#else
-#define Tk_Offset(type, field) ((int) ((char *) &((type *) 0)->field))
+/* Workaround for platforms missing offsetof(), e.g. VC++ 6.0 */
+#ifndef offsetof
+# define offsetof(type, field) ((size_t) ((char *) &((type *) 0)->field))
#endif
/*