X-Authentication-Warning: acp3bf.physik.rwth-aachen.de: broeker owned process doing -bs Date: Mon, 17 May 1999 10:33:44 +0200 (MET DST) From: Hans-Bernhard Broeker X-Sender: broeker AT acp3bf To: djgpp-workers AT delorie DOT com Subject: Re: wctype.h and ctype.h In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sun, 16 May 1999, Eli Zaretskii wrote: > On Thu, 13 May 1999, DJ Delorie wrote: > > > It wrong for wctype.h to include inlines/ctype.ha. It should include > > inlines/wctype.ha if it has inline functions. > > Why can't wctype.h use inlines/ctype.ha, if it needs it? Does the > standard preclude it? Unless I misread Plauger's 'The Standard C Library', it does. In a nutshell: any interdependency between the standard C headers is forbidden. Nothing that is defined by header may be defined just because you #include another standard header. This is for keeping the namespace clean; so if you don't #include, say, ctype.h, you can write your own function isupper(), and none of the other library functions (outside ) is allowed to change behaviour because of this. This rule alone doesn't disallow #include inside , yed. But the fact that does contain lines like #define isupper(c) .... does. This would have to be changed. Unless I'm totally off track, here, needs its own , instead of including the one from . > How about including ctype.h from wctype.h? Will that be good enough? That's forbidden by the standard, by induction from what I said above. No standard header inclusion is allowed to effect inclusion of any other standard header. The basis of this is a bit hard to isolate from the text of the standard, though, so let me show it. Quote is from C9x draft, but this paragraph is unchanged from C89, it seems. It's in section 7.1.3 'Reserved identifiers': -- Each identifier with file scope listed in any of the following subclauses (including the future library directions) is reserved for use as macro and as an identifier with file scope in the same name space if any of its associated headers is included. [#2] No other identifiers are reserved. If the program [...] Together, these two clauses mean: standard library function names are only reserved *if* you #include the standard header that defines them. Turning this around, you get that if the program doesn't #include , the compiler may not assume anything about isupper(). This then precludes that #include could #include or its corresponding inlined version behind the users back. Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.