Re: hunt_victim()

From: Herbert Kremser (kremser@flinux.tu-graz.ac.at)
Date: 08/17/95


On Wed, 16 Aug 1995, Gary wrote:

> On Wed, 16 Aug 1995, Jörgen Zigge Sigvardsson wrote:
> > 
> > > void hunt_victim();
> > 
> > 
> > Hmm.. A prototype like that would 'eliminate' warnings, or?
> > Lets say the function is defined like this ;
> > 
> > void hunt_victim(char *, struct char_data *)
> > {
> > 	/* Some code */
> > }
> > 
> > And you call the the function like this;
> > 
> > char *string;
> > struct char_data *ch;
> > 
> > hunt_victim(ch, string); 
> > ...
> > 
> > Note that the arguments are switched. 
> > 
> > Now my question is, will the compiler complain at the function-call or
> > will it just let it slip?
> > 
> > 
> Actually, it will catch the error while linking, but the compiler will 
> let it through.
> 

This is not true. Which linker do you use, who will complain about such
an error?
Usually the only instance which gives out a warning about wrong parameters
is the compiler, and the compiler can't do that without prototype.
Even if you use a wrong prototype in one file, neither the linker nor
the compiler will complain, therefore it's better in my experience,
to put prototypes in header files, and not in the .c files itself.

Herbert

[on public request 12 lines of signature deleted]  *snip* ;)



This archive was generated by hypermail 2b30 : 12/18/00 PST