Bug 4590 - Defining _POSIX_ breaks math.h
Summary: Defining _POSIX_ breaks math.h
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: glibc
Version: 1.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Cristian Gafton
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 1999-08-18 17:05 UTC by mcfarlan
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 1999-08-27 23:43:00 UTC

Attachments (Terms of Use)

Description mcfarlan 1999-08-18 17:05:24 UTC
It seems that due to recent changes in glibc, defining
_POSIX_ in a C source file that includes math.h will cause
parsing of math.h to fail.  A minimal example:

#define _POSIX_

#include <stdio.h>
#include <math.h>

int main()
  printf("y = %g\n", sin(1.5));
  return 0;

If I compile this via

    cc -Wall -lm foo.c -o foo

I get the error message

    In file included from foo.c:4:
    /usr/include/math.h:241: parse error before `,'

But if I delete the line #define _POSIX_, this code compiles
and runs.

At a glance, I suspect that _ISOC_ on line 242 of
/usr/include/math.h is not always defined.

I'm running RH 6.0 on a Pentium with a kernel built from the
2.2.11-1 sources.  glibc and glibc-devel are version 2.1.2-4
from rawhide.

Comment 1 Cristian Gafton 1999-08-27 23:43:59 UTC
_POSIX_ is a reserved identifier by the ISO C 98

Note You need to log in before you can comment on or make changes to this bug.