diff options
author | patthoyts <patthoyts@users.sourceforge.net> | 2007-08-01 13:27:46 (GMT) |
---|---|---|
committer | patthoyts <patthoyts@users.sourceforge.net> | 2007-08-01 13:27:46 (GMT) |
commit | 151923cca7b86c51a2292b427fbf70e75b05bbe3 (patch) | |
tree | 21bf6522d2470c253e81d43377bbbb994415144c /generic/tclInt.h | |
parent | 24d28892567192aedf221dde8efe1939487fd017 (diff) | |
download | tcl-151923cca7b86c51a2292b427fbf70e75b05bbe3.zip tcl-151923cca7b86c51a2292b427fbf70e75b05bbe3.tar.gz tcl-151923cca7b86c51a2292b427fbf70e75b05bbe3.tar.bz2 |
Abstracted the 'offsetof' to a TclOffset macro as per Tk_Offset to permit
compilation with MSVC6 and anything else that may not define this macro.
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r-- | generic/tclInt.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index 032a2f6..947d6ec 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.325 2007/07/31 17:03:38 msofer Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.326 2007/08/01 13:27:47 patthoyts Exp $ */ #ifndef _TCLINT @@ -3488,6 +3488,18 @@ MODULE_SCOPE void TclBNInitBignumFromWideUInt(mp_int *bignum, #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. + */ + +#ifdef offsetof +#define TclOffset(type, field) ((int) offsetof(type, field)) +#else +#define TclOffset(type, field) ((int) ((char *) &((type *) 0)->field)) +#endif + +/* *---------------------------------------------------------------- * Inline version of Tcl_GetCurrentNamespace and Tcl_GetGlobalNamespace */ |