[webkit-dev] use of isnan with integers (QNX gcc)

Shkrablyuk, Pavel PShkrablyuk at luxoft.com
Fri Jul 22 02:16:59 PDT 2011

Here's code from 'WebCore/html/canvas/WebGLRenderingContext.cpp'

WebGLRenderingContext::viewport(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height)
    if (isContextLost())
    if (isnan(x))
        x = 0;
    if (isnan(y))
        y = 0;
    if (isnan(width))
        width = 100;
    if (isnan(height))
        height = 100;

In 'WebCore/platform/graphics/GraphicsTypes3D.h' 'GC3Dint' and 'GC3Dsizei' are defined as follows:
typedef int GC3Dint;
typedef int GC3Dsizei;

This can't be compiled, in QNX gcc implementation (gcc version 4.4.2).
C:/QNX650/target/qnx6/usr/include/math.h: In function 'bool std::isnan(_Ty) [with _Ty = int]':
D:/wkt/Source/WebCore/html/canvas/WebGLRenderingContext.cpp:3925:   instantiated from here
C:/QNX650/target/qnx6/usr/include/math.h:212: error: call of overloaded 'fpclassify(int&)' is ambiguous
C:/QNX650/target/qnx6/usr/include/math.h:166: note: candidates are: int std::fpclassify(float)
C:/QNX650/target/qnx6/usr/include/math.h:171: note:                 int std::fpclassify(double)
C:/QNX650/target/qnx6/usr/include/math.h:176: note:                 int std::fpclassify(long double)

Maybe I don't understand something. Is there really a reason to check for 'isnan' of integer values in WebGLRenderingContext::viewport?

If this code is really necessary, then I'll add explicit cast to floating value, if not then I'll remove it entirely.

Best Regards,
Pavel Shkrablyuk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110722/58905731/attachment.html>

More information about the webkit-dev mailing list