Subject: standards/36988: math.h C99 constants are not constant
To: None <standards-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <Peter.Bex@xs4all.nl>
List: netbsd-bugs
Date: 09/14/2007 11:15:01
>Number:         36988
>Category:       standards
>Synopsis:       INFINITY, HUGE_VALF etc are not real constants
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 14 11:15:01 +0000 2007
>Originator:     Peter.Bex@xs4all.nl
>Release:        NetBSD 4.0_RC1
>Organization:
	
>Environment:
	
	
System: NetBSD byers.homeunix.org 4.0_RC1 NetBSD 4.0_RC1 (GENERIC) #0: Mon Sep 3 21:50:07 CEST 2007 sjamaan@byers.homeunix.org:/usr/src/sys/arch/macppc/compile/GENERIC macppc
Architecture: powerpc
Machine: macppc
>Description:

The C99 spec says that INFINITY, HUGE_VALF, HUGE_VALL, NAN and HUGE_VAL
should expand to a constant expression.  They don't.

This means that these values cannot be used as initializers.

>How-To-Repeat:

Try to compile the program:

#include <math.h>
double x = INFINITY;
int main(void)
{
	printf("X = %f\n", x);
	return 0;
}

GCC will complain:
infinity.c:2: error: initializer element is not constant
>Fix:
	N/A

>Unformatted: