diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-06-12 15:26:27 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-06-12 15:26:27 (GMT) |
commit | 19d8ff62c56686e2c07979778a64661229c62a64 (patch) | |
tree | 72de2a9bac1693435bbc7b11aba109f51ef94955 /generic/tclInt.h | |
parent | 100d8f950dbcdf50e48c8d257a98ee915c043e30 (diff) | |
download | tcl-19d8ff62c56686e2c07979778a64661229c62a64.zip tcl-19d8ff62c56686e2c07979778a64661229c62a64.tar.gz tcl-19d8ff62c56686e2c07979778a64661229c62a64.tar.bz2 |
Eliminate (internal) TclOffset() usage, just use offsetof() in stead.
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r-- | generic/tclInt.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index e853f08..c844cc4 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4868,15 +4868,16 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; #endif /* - * ---------------------------------------------------------------------- - * Macro to use to find the offset of a field in a structure. Computes number - * of bytes from beginning of structure to a given field. + * Macro to use to find the offset of a field in astructure. + * Computes number of bytes from beginning of structure to a given field. */ -#ifdef offsetof -#define TclOffset(type, field) ((int) offsetof(type, field)) -#else -#define TclOffset(type, field) ((int) ((char *) &((type *) 0)->field)) +#ifndef TCL_NO_DEPRECATED +# define TclOffset(type, field) ((int) offsetof(type, field)) +#endif +/* Workaround for platforms missing offsetof(), e.g. VC++ 6.0 */ +#ifndef offsetof +# define offsetof(type, field) ((size_t) ((char *) &((type *) 0)->field)) #endif /* |