Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!yale!cs.utexas.edu!uwm.edu!lll-winken!gauss.llnl.gov!casey From: casey@gauss.llnl.gov (Casey Leedom) Newsgroups: comp.windows.x Subject: Re: X11R4 xrn (contrib) and congrats... Message-ID: <43855@lll-winken.LLNL.GOV> Date: 10 Jan 90 11:35:13 GMT References: <1990Jan9.120453.15352@ux1.cso.uiuc.edu> <2013@eric.mpr.ca> Sender: usenet@lll-winken.LLNL.GOV Reply-To: casey@gauss.llnl.gov (Casey Leedom) Organization: Lawrence Livermore National Laboratory Lines: 36 I notice quite a few uses of XtNewString with constant strings in xrn. since you're using GCC, you're probably getting bitten by the GCC bug I mentioned earlier. GCC compiles the following: "..." == 0 ? exp1 : exp2 into exp1 instead of exp2 as it should. This bug is in 1.34 and 1.36 at least, and someone told me that it was also in 1.35. Richard Stallman tells me that the BETA version of GCC 1.37 (soon to be released). In the mean time there's a fairly simple work around. Just rewrite the ternary expression as: "..." != 0 ? exp2 : exp1 Here's the patch one more time: *** mit/lib/Xt/Intrinsic.h-dist Fri Dec 15 04:35:00 1989 --- mit/lib/Xt/Intrinsic.h Sun Jan 7 20:43:15 1990 *************** *** 2144,2150 **** #define XtNew(type) ((type *) XtMalloc((unsigned) sizeof(type))) #define XtNewString(str) \ ! ((str) == NULL ? NULL : (strcpy(XtMalloc((unsigned)strlen(str) + 1), str))) extern char *XtMalloc( #if NeedFunctionPrototypes --- 2144,2150 ---- #define XtNew(type) ((type *) XtMalloc((unsigned) sizeof(type))) #define XtNewString(str) \ ! ((str) != NULL ? (strcpy(XtMalloc((unsigned)strlen(str) + 1), str)) : NULL) extern char *XtMalloc( #if NeedFunctionPrototypes