home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16958 < prev    next >
Encoding:
Internet Message Format  |  1992-11-21  |  1.0 KB

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