Updated 2011-04-04 07:49:23 by RLE

If you've ever built a custom tclsh or wish, you may have inherited the following bit of code that first appeared in the tclAppInit.c file in Tcl 7.4:
  | /*
  |  * The following variable is a special hack that is needed in order   for
  |  * Sun shared libraries to be used for Tcl.
  |  */
  |
  | extern int matherr();
  | int *tclDummyMathPtr = (int *) matherr;

If so, you should take it out.

The original reason for this special hack has been lost in the sands of time, but it is definitely no longer needed on current versions of Solaris or any other modern Unix.

In fact, there is a good chance that from Tcl 8.1 onwards this snippet would have done the wrong thing -- Tcl's implementation of matherr() got broken when thread support was added. But nobody ever noticed, since very few systems even use matherr() anymore. This has been dead code for a long time, but relatively harmless.

However, as of release 8.4b1, Tcl no longer includes a definition of matherr() at all, so the tclDummyMathPtr hack will now cause a link error on some systems. The correct solution is to remove this snippet of code entirely. This will not cause any backwards-compatibility problems, except possibly for the mysterious "Sun shared libraries" issue that affected Tcl 7.4.

The full story is recorded in Tcl bug #474335 "logic of matherr is backwards" [1] and in Tcl patch #555635 "Dead code: matherr, TclMathInProgress" [2]