home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / os2 / programm / 4445 < prev    next >
Encoding:
Internet Message Format  |  1992-08-25  |  2.8 KB

  1. Path: sparky!uunet!inmos!wraxall.inmos.co.uk!frogland.inmos.co.uk!des
  2. Newsgroups: comp.os.os2.programmer
  3. From: des@frogland.inmos.co.uk (David Shepherd)
  4. Subject: Re: gcc error in <stdio.h>
  5. Message-ID: <1992Aug26.113212.15062@wraxall.inmos.co.uk>
  6. Organization: INMOS architecture group
  7. References: <1992Aug25.210547.128@physc1.byu.edu>
  8. Date: Wed, 26 Aug 92 11:32:12 BST
  9. Lines: 56
  10.  
  11. In article <1992Aug25.210547.128@physc1.byu.edu>, robertson@physc1.byu.edu writes:
  12. >>   I just started using gcc today.  I am new to c programming as well.
  13. >>   After installing gcc for OS/2 and following the directions in the
  14. >>   README and INSTALL files in the \gnu\doc directory, I read through
  15. >>   the first 30-40 pages about the command line parameters.  I thought
  16. >>   I understood so I tried to invoke the command from the gnu directory:
  17. >>
  18. >>          gcc samples\sample1.c -ansi -pedantic -g
  19. >>
  20. >>   which tells me that I have an error:
  21. >>
  22. >>          E:\GNU\GCC-INCLUDE/stdio.h:313: syntax error before `int'
  23. >>
  24. >>   I assumed that 313 meant in line 313 so I looked it up
  25. >>   It is this:
  26. >>          static inline int__sputc[int_c, FILE *_p] {
  27. >                  ^^^^^^
  28. >    I deleted this word and now it works.  I thought to delete it
  29. >    because when I looked up static in my c book it always preceded a
  30. >    variable type.  So I tried it.   Why does it now work?  Did I mess
  31. >    the header up at all?
  32.  
  33. i think the situation is that "inline" is an additional feature to
  34. gcc that tells gcc to expand that function into inline code
  35. on all calls (i'd expect that it has to be static).
  36.  
  37. you're probably quite correct about it not being in your c book as
  38. its an additional feature in gcc.
  39.  
  40. your problem occurs because of the -ansi switch where you tell gcc
  41. to only accept ANSI-C syntax (i.e. report K&R style *and* any gcc
  42. extensions as errors).
  43.  
  44. I don't think you need the -ansi switch *unless* you really want to
  45. check of ansiness (ansisity ?) of the code as gcc sort of auto-detects
  46. what sort of code its getting on the fly. then your problem may
  47. go away.
  48.  
  49. related to this ... there are some other problems as gcc uses inline
  50. functions for things that other headers define as macros which
  51. various sources try to redefine by #undef, #define which of course
  52. now fails.
  53.  
  54. Also, i get occasional problems with a couple of inline functions
  55. (forgotten which one buts its towards the end of math.h among
  56. other places ... abs() ?) which won't parse correct if gcc thinks
  57. its parsing non-ansi C or something like that.
  58.  
  59.  
  60. -- 
  61. --------------------------------------------------------------------------
  62. david shepherd: des@inmos.co.uk or des@inmos.com    tel: 0454-616616 x 625
  63.                 inmos ltd, 1000 aztec west, almondsbury, bristol, bs12 4sq
  64.                 "i don't consider myself to be narcissitic .... if i had a
  65.                  role model from mythology it would be zeus" - woody allen
  66.  
  67.