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