Article View: comp.std.c
Article #185Re: Name space question
From: Norman Diamond
Date: Mon, 06 Apr 1992 00:02
Date: Mon, 06 Apr 1992 00:02
32 lines
1961 bytes
1961 bytes
In article <1992Apr4.011606.23687@mindcraft.com> fred@mindcraft.com (Fred
Zlotnick) writes:
>Suppose an implementation header defines a macro
> #define _toupper(ch) ( (ch) + 'A' - 'a' )
>or something similar. (This is quite common.)
It's not common in ANSI conforming implementations, except possibly as an
extension where the program has to do some non-strictly-conforming thing
in order to request the extension.
>Does this step on the application's namespace? An application is free to
>declare an identifier "_toupper" as long as it does not have file scope.
It does, for the reason you gave.
>This is a function-like macro, and thus is only expanded when the identifier
>is immediately followed by a left parenthesis. So I guess my question is:
>Can an identifier that is not an external identifier ever legally be followed
>by a left parenthesis?
If the implementation fails to accept this:
#include <stdlib.h>
#include <ctype.h> /* Can use name _toupper for SOME things */
main() {
void (*_toupper)() = &exit; /* Program declares block-scope variable */
_toupper(EXIT_SUCCESS); /* Program uses block-scope variable */
}
then the implementation is non-conforming.
--
Norman Diamond diamond@jit081.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
"Yeah -- bad wiring. That was probably it. Very bad."
Technical Details
Message-ID:
<1992Apr6.000211.13616@news.jit.dec.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!decwrl!pa.dec.com!jrdzzz.jrd.dec.com!usenetReferences:
<1992Apr4.011606.23687@mindcraft.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!decwrl!pa.dec.com!jrdzzz.jrd.dec.com!usenet From: diamond@jit533.jit.dec.com (Norman Diamond) Subject: Re: Name space question Message-ID: <1992Apr6.000211.13616@news.jit.dec.com> Lines: 31 Sender: usenet@news.jit.dec.com (USENET News System) Nntp-Posting-Host: jit345 Reply-To: diamond@jit.dec.com (Norman Diamond) Organization: Digital Equipment Corporation Japan , Tokyo References: <1992Apr4.011606.23687@mindcraft.com> Date: Mon, 6 Apr 1992 00:02:11 GMT Lines: 32