Re: Least favorite quirk

From: George Greer (
Date: 07/30/01

On Fri, 27 Jul 2001, Mike Breuer wrote:

>The number one thing I found annoying when I first started working with
>the code is the use of macros for function prototyping: SPECIAL, ACMD,
>ASPELL, etc.  I had to dig all around the code to figure out whether the
>variables being used were global or passed as parameters.  It made
>writing that first spec proc a little more grueling than it needed to be.

It's rather nice to be able to search for such functions but it does
obscure the variables.  Four of the 'arg -> argument' bugs uncovered by the
global variable removal are due to such macros.  We could do:

  SPECIAL(shopkeeper, ch, me, cmd, argument)

so that the arguments can be named whatever you want, but then you forget
the types.  What might be better is:

  SPECIAL(void shopkeeper(struct char_data *ch, void *me, int cmd,
        char *argument)

where SPECIAL is:

  #define SPECIAL(x)    x

That removes the benefit of easily changing the variables for your special
procedures though.  All of them must have the same arguments anyway.

>Another (minor) thing I noticed recently, is just a silly thing in mag_affects
>(magic.c).  The to_vict message and to_room message are sent to act like this:
>act(to_vict, FALSE, victim, 0, ch, TO_CHAR);
>act(to_room, TRUE, victim, 0, ch, TO_ROOM);
>instead of:
>act(to_vict, FALSE, ch, 0, victim, TO_VICT);
>act(to_room, TRUE, ch, 0, victim, TO_NOTVICT);

A little funny.  I'll take a look and see how it compares to the others.

George Greer

   | FAQ: |
   | Archives: |

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