public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* parse error before `PARAMS' ? help please.
@ 2002-09-01 12:37 Guy Montag
  2002-09-01 14:23 ` Alexandre Oliva
  0 siblings, 1 reply; 3+ messages in thread
From: Guy Montag @ 2002-09-01 12:37 UTC (permalink / raw)
  To: gcc

I have been trying to figure out why when I include a
GCC header that contains a prototype such as:

extern int toplev_main PARAMS ((int, char **));

the compiler returns:

toplev.h:29: parse error before `PARAMS'

I am coming from a strong Java background and have
been programming in C++ for a little while now. I
think I remember this PARAMS keyword being mentioned
in the C book (Kernighan-Ritchie). Is it an older C
function style or is some kind of macro specific to
GCC?

Guidance is this regard would be greatly appreciated!

Thank You,
-Guy

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: parse error before `PARAMS' ? help please.
  2002-09-01 12:37 parse error before `PARAMS' ? help please Guy Montag
@ 2002-09-01 14:23 ` Alexandre Oliva
  2002-09-01 14:38   ` Guy Montag
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Oliva @ 2002-09-01 14:23 UTC (permalink / raw)
  To: Guy Montag; +Cc: gcc

On Sep  1, 2002, Guy Montag <theguymontag@yahoo.com> wrote:

> Is it an older C function style or is some kind of macro specific to
> GCC?

It's specific to GCC, even though it's a common idiom to projects that
still care about being compilable by K&R C compilers without giving up
prototypes when being compiled with ISO C compilers.

Basically, PARAMS is defined such that, on K&R C, it expands to (),
whereas in ISO C, it expands to its sole argument, an argument list
enclosed in parentheses.  See include/ansidecl.h.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: parse error before `PARAMS' ? help please.
  2002-09-01 14:23 ` Alexandre Oliva
@ 2002-09-01 14:38   ` Guy Montag
  0 siblings, 0 replies; 3+ messages in thread
From: Guy Montag @ 2002-09-01 14:38 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc

--- Alexandre Oliva <aoliva@redhat.com> wrote:
> On Sep  1, 2002, Guy Montag <theguymontag@yahoo.com>
> wrote:
> 
> > Is it an older C function style or is some kind of
> macro specific to
> > GCC?
> 
> It's specific to GCC, even though it's a common
> idiom to projects that
> still care about being compilable by K&R C compilers
> without giving up
> prototypes when being compiled with ISO C compilers.
> 
> Basically, PARAMS is defined such that, on K&R C, it
> expands to (),
> whereas in ISO C, it expands to its sole argument,
> an argument list
> enclosed in parentheses.  See include/ansidecl.h.
> 
> -- 
> Alexandre Oliva   Enjoy Guarana', see
> http://www.ic.unicamp.br/~oliva/
> Red Hat GCC Developer                
> aoliva@{redhat.com, gcc.gnu.org}
> CS PhD student at IC-Unicamp       
> oliva@{lsd.ic.unicamp.br, gnu.org}
> Free Software Evangelist                Professional
> serial bug killer

Alexandre,
I knew I had seen the expression in the context of old
c syntax. I started looking through the headers file
and the first definition in config.h is ansidecl.h.
What an idiot. I should try using a little more
discression before risking the waste of anyones time.
I was just about to closeout the question! Thank you
for your time and the detail on K&R C!!!

Rock on down in Brazil! !Y tenga una buena semana mi
amigo! !Tu ayuda fue excelente!

Muchas gracias,
-Guy






__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-09-01 21:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-01 12:37 parse error before `PARAMS' ? help please Guy Montag
2002-09-01 14:23 ` Alexandre Oliva
2002-09-01 14:38   ` Guy Montag

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).