Re: [Circle] Compiler error uner WinNT4.0 using Symantec C++ 7.21 compiler.

From: Derek Karnes (dkarnes@mystech.com)
Date: 08/14/96


--
if (GET_ROOM_SPEC(ch->in_room) != NULL)
   if (GET_ROOM_SPEC(ch->in_room) (ch, world + ch->in_room, cmd, arg))
      return 1;
--

If you break it apart, it looks like this:

GET_ROOM_SPEC(ch->in_room) = get the special for this room - this returns a pointer
to a function.

(ch, world + ch->in_room, cmd, arg) = the parameter list for the afore-mentioned
function.

So, for example, if the char is in room 1 and the special for that room is
do_die_a_nasty_death, then the it calls the function:
    do_die_a_nasty_death(ch, world+1, cmd, arg)
If the spec_proc function do_die_a_nasty_death returns true, then the
if(GET_ROOM_SPEC(ch->in_room)... evaluates true and the whole procedures falls
through to the next line (return 1;)

Clearer pseudo-code for this procedure would like something like:

void *room_function;
int room_spec_proc_occurred = FALSE;

room_function = GET_ROOM_SPEC(ch->in_room);
if (room_function) 
{
	room_spec_proc_occurred = room_function(ch, world+ch->in_room, cmd, arg);
	if (room_spec_proc_occurred)
		return 1;
}     


Hope that helps the understanding part, but it doesn't help the problem that it
doesn't work for WinNT4.0 using Symantec C++ 7.21; the code is fine and is the
standard stock Circle...


Derek Karnes
--

Charles Canning wrote:
> 
> Hi everyone,
> 
> I could be be totally wrong in this case but I don't see how this code
> would compile under any C compiler.
> 
> >
> > -- SNIP --
> >
> >   /* special in room? */
> >   if (GET_ROOM_SPEC(ch->in_room) != NULL)
> >      if (GET_ROOM_SPEC(ch->in_room) (ch, world + ch->in_room, cmd, arg))
>                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> What is this supposed to do? I do not understand?
> 
> >       return 1;

--
                                    \ | /
                        \  /---------------------\  /
			--   dkarnes@mystech.com   --
                        /  \---------------------/  \
				    / | \
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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