Re: [xml] XPath Infinities

On Fri, Apr 27, 2001 at 05:25:58PM +0200, Igor Zlatkovic wrote:
Hello Daniel, everybody

I encountered a slight difficulty while building version 2.3.7 under
Win32/MSCC. The compiler refuses to divide a constant by zero. The recent
changes in xpath.c which introduce these divisions broke the build under

  this whole issue is a huge mess ...

Namely, if you let MSCC divide a variable by zero, you get a NaN or
positive/negative infinity, depends on what the variable contains, as was
the intention. For some reason, MSCC considers it an error to divide a
constant by zero and assign the result to a variable.

  yet another buggy compiler :-\

someone with Linux on alpha recently said that his setup wants this to be
just the other way around?

I would suggest the following patch to xpath.c. It makes no difference to
those who succeed compiling 2.3.7 as it is. Those of us who use MSCC and
similar compilers would then be responsible to define this
XPATH_USE_DIVISION_SHORTCUTS macro somewhere. The alternative to this seems
to be disabling XPath under Win32/MSCC.

What do you think? 

   Considering that compiler A and compiler B refuse to behave decently
on the same code we will have to use #ifdefs :-(
   Removing XPath is annoying since libxslt requires it

+     xmlXPathNAN /= 0.0;
+     xmlXPathPINF /= 0.0;
+     xmlXPathNINF /= 0.0;
+ #else
      xmlXPathNAN = 0.0 / 0.0;

      xmlXPathPINF = 1 / 0.0;

      xmlXPathNINF = -1 / 0.0;
+ #endif

  or rather:

        xmlXPathNAN = 0;
        xmlXPathNAN /= 0.0;
        xmlXPathPINF = 1;
        xmlXPathPINF /= 0.0;
        xmlXPathNINF = -1;
        xmlXPathNINF /= 0.0;
        xmlXPathNAN = 0.0 / 0.0;
        xmlXPathPINF = 1 / 0.0;
        xmlXPathNINF = -1 / 0.0;

  I let you provide the patch to the Windows include to define


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]