Re: hunt_victim()

From: J\vrgen (di4sig@douglas.cse.hks.se)
Date: 08/16/95


> This is what is known as 'prototyping'.  What this means is you let a 
> function or a file know that an external function exists.  Alternately, 
> you could use:

> void hunt_victim();

> If you change the structure of the parameters anywhere, using this 
> example keeps you from having to redefine prototypes.  This, of course, 
> isn't true if you change the returned data structure or the name.

> It seems obvious to some, not so obvious to others.  It's good you 
> brought that up, however.


Hmm.. A prototype like that would 'eliminate' warnings, or?

If you prototype with void hunt_victim() you havent specified the arguments.

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?

>From what I've learned, the prototype is the one the compiler use for detecting
faults, and the prototype allows any kind of arguments, but the function dont.

// Ziggur @ BlueMage



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