Re: [CODE] some helpfull stuff

From: Patrick Dughi (
Date: 11/23/98

> Two a horrible thing in the most recent gcc's(This leads to a suggestion)
> Okay take two functions. update_pos(blah) and die(blah, indeed),
> if you add a call for die in a file gcc will warn implicit declare of blah
> if you dont add a void die(blah, indeed); up top of the file which needs
> done. But if you add update_pos(blah) it want warn it assumes void
> update_pos(int) which is _not_ good.

        If I know my gcc, in the absence of a prototype - which is what I
think you're getting at..hard to understand - your functions should be
implicitly declared to return int, and their argument types should be
determined from the arguments given to them.  In anycase, prototyping your
functions is warned by gcc, if you add in all the following flags:

-Wall -fno-strict-prototypes

        These will do two things - the first will give you warnings when
you implicitly define something (ie w/o prototypes) and the second will
set your prototypes if you forget them, to something reasonable, without
too much power.

> It would be nice to have circle make a prototypes.h file that is included
> in all .c files. Of course this file will have a prototype of all
> functions. There is even a program that will make you one!

        It doesn't take much effort to make this file, and even less
effort to simply prototype your functions in the files they're used in.


     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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