Am Samstag, 28. April 2012, 10:16:13 schrieb Thomas Faber:
Apparently NAN and INFINITE are C99 as well (I should really get a version of the old standard instead of mostly reading C99 :|).
How about a simple const variable that will trick MSVC, while not changing semantics.
How about a function in libs/port or a macro in one of its headers? I believe the NAN/INFINITE issue is not specific to wined3d.
With the const variable, msvc compiles the code, but still produces a warning.
On 2012-04-29 12:05, Stefan Dösinger wrote:
Am Samstag, 28. April 2012, 10:16:13 schrieb Thomas Faber:
Apparently NAN and INFINITE are C99 as well (I should really get a version of the old standard instead of mostly reading C99 :|).
How about a simple const variable that will trick MSVC, while not changing semantics.
How about a function in libs/port or a macro in one of its headers? I believe the NAN/INFINITE issue is not specific to wined3d.
With the const variable, msvc compiles the code, but still produces a warning.
Ah, the warning appears only with optimization enabled, that's why I didn't notice.
port sounds great - but (assuming there shouldn't be any "0x7fc00000" or "#ifdef _MSC_VER" in the solution) the best I can come up with at the moment is the following :|
#ifndef INFINITY static float __infinity(int x) { const float zero = x ? 0.0f : 1.0f; return 1.0f / zero; } # define INFINITY __infinity(1) #endif
#ifndef NAN static float __nan(int x) { const float zero = x ? 0.0f : 1.0f; return zero / zero; } # define NAN __nan(1) #endif
Am Montag, 30. April 2012, 15:26:30 schrieb Thomas Faber:
port sounds great - but (assuming there shouldn't be any "0x7fc00000" or "#ifdef _MSC_VER" in the solution) the best I can come up with at the moment is the following :|
Alexandre prefers checks in configure that set macros like HAVE_INFINITY in config.h. For my own msvc builds I have a hand-written config.h file - I'm not sure if there's a way to tell configure running in mingw or cygwin to use msvc as the compiler.