home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!sun4nl!and!jos
- From: jos@and.nl (Jos Horsmeier)
- Newsgroups: comp.lang.c
- Subject: Re: order of 'external' declarations
- Message-ID: <3905@dozo.and.nl>
- Date: 21 Nov 92 17:36:28 GMT
- References: <P438VUC@gwdu03.gwdg.de>
- Organization: AND Software BV Rotterdam
- Lines: 23
-
- In article <P438VUC@gwdu03.gwdg.de> moeller@gwdgv1.gwdg.de writes:
- |I've just come across a supposedly ANSI-compatible C compiler that chokes on
- |
- | func()
- | {
- | extern char *var;
- | ...
- | }
- |
- | char *var = "some text";
- |
- |With functions, this kind of "forward" declaration is quite normal,
- |so I think it should also be ok with data (for which you have
- |to explicitly use 'extern'). Any opinions?
-
- Yes, I have two opinions: you are right and your compiler is wrong.
- It is perfectly legal to use the `extern' storage class specifier
- inside a function. It simply tells the compiler that the declared
- argument is defined somewhere else, _outside_ the function block scope.
-
- kind regards,
-
- Jos aka jos@and.nl
-