Re: [NEWBIE][CODE]Autosac

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 12/22/02


On Sun, 22 Dec 2002, Jimmie Tryon wrote:

> fight.c:887: warning: implicit declaration of function `do_sac'
>
> do_sac(ch, "corpse", 0, 0);

It is, in fact, something simple.  It's precisely what the warning message
describes (and please note that it's a *WARNING*, not an error).  An
introductory book to the C programming language would cover this.  You
must declare the existence and type of a function (or variable) before you
use it.  Here, you're using the do_sac() function.  Later (or perhaps in
another file), you define it.  Since you're using it before the definition
and without a declaration, the compiler sees your call to do_sac() before
it knows what do_sac() is.  A function prototype will make the warning go
away.  Just place:

  ACMD(do_sac);

in fight.c.  A good place would be where the other function prototypes
are at the beginning of the file, beneath "/* local functions */".

-dak

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT