Re: Dual Wield..

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 09/26/01


On Wed, 26 Sep 2001, Mielikki wrote:

> fight.c: In function `hit':
> fight.c:908: warning: implicit declaration of function `double_hit'

Means exactly what it says.  You don't have an explicit declaration of the
function double_hit() before it's used, so it makes one up, which . . .

> fight.c:913: warning: type mismatch with previous implicit declaration
> fight.c:908: warning: previous implicit declaration of `double_hit'
> fight.c:913: warning: `double_hit' was previously implicitly declared to
> return
> `int'

conflicts with the actual one.  Either move the double_hit() function
above where it's called or put a prototype above where it's called.  A
prototype is a declaration of a function's existence and types.  It looks
exactly like a function definition (what you have beginning at line 913,
there), except instead of the function's body in { ... }, there's just a
semicolon:

  void double_hit(struct char_data *ch, struct char_data *victim,
                  int type);

You could also omit the names of the arguments (ch, victim, type) from the
prototype.  Despite being shorter (and thus easier to type), this isn't
necessarily desirable: the names are nicely self-documenting.

-dak

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST