Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jul 1995 15:01:15 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        gordon@sneaky.lonestar.org
Cc:        current@freebsd.org
Subject:   Re: i386/596: \<ctype.h> and \<stdlib.h> conflict with _POSIX_SOURCE
Message-ID:  <199507070501.PAA05751@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>>Synopsis:       <ctype.h> and <stdlib.h> conflict with _POSIX_SOURCE

>>How-To-Repeat:

>	Compile the following 3-line program (cc -c x.c):

>	# define _POSIX_SOURCE
>	# include <stdlib.h>
>	# include <ctype.h>

>	and get a flood of error messages starting with complaints
>	about rune_t (a typedef apparently not defined).

>	however, this works:

>	# define _POSIX_SOURCE
>	# include <ctype.h>
>	# include <stdlib.h>

Oops.  They also work individually, so they should work in any order if
they are idempotent.  They aren't idempotent.  <runetype.h> bases its
decision to declare rune_t (and wchar_t) on the undefined'ness of
_BSD_WCHAR_T_, but <stdlib.h> uses _BSD_WCHAR_T_ to control only wchar_t
if either _POSIX_SOURCE or _ANSI_SOURCE is defined.

Fix: there should be a separate guard _BSD_RUNE_T_ for rune_t.  rune_t
should not be declared if _POSIX_SOURCE is defined and only the above
headers are included, but this is a different bug.  The separate guard
is required to make the following work:

	#define _POSIX_SOURCE
	#include <stdlib.h>
	#include <ctype.h>
	#include <runetype.h>

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199507070501.PAA05751>