mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-22 21:40:41 +02:00
option-context.c: Define NAN if not defined on MSVC
This will enable the build to succeed on older Visual Studio versions that don't support NAN yet. Other supported compilers should support this.
This commit is contained in:
parent
d51c3b01fe
commit
20bd716d4c
@ -28,6 +28,24 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# ifndef NAN
|
||||||
|
/*
|
||||||
|
* From the Visual Studio 2013+ math.h, we have the following:
|
||||||
|
* #ifndef _HUGE_ENUF
|
||||||
|
* #define _HUGE_ENUF 1e+300 // _HUGE_ENUF*_HUGE_ENUF must overflow
|
||||||
|
* #endif
|
||||||
|
*
|
||||||
|
* #define INFINITY ((float)(_HUGE_ENUF * _HUGE_ENUF))
|
||||||
|
* ...
|
||||||
|
* #define NAN ((float)(INFINITY * 0.0F))
|
||||||
|
* ...
|
||||||
|
* so, HUVE_VAL * HUGE_VAL would be a good approximation of INFINITY without
|
||||||
|
* defining anything extra
|
||||||
|
*/
|
||||||
|
# define NAN HUGE_VAL * HUGE_VAL * 0.0f
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
static GOptionEntry main_entries[] = {
|
static GOptionEntry main_entries[] = {
|
||||||
{ "main-switch", 0, 0,
|
{ "main-switch", 0, 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user