Re: [BUG][Code] crashing every 6 hours

From: Mysidia (jmhess@i-55.com)
Date: 11/19/01


> Yeah, I did that yesterday and it worked, and for the life of me, I
> couldnt not tell the difference. Reading the macro, it seems to be the
> same as above
> ie. #define GET_RACE(ch)  (IS_MOB(ch) ? ch->mob_specials.race :
> ch->player_specials->saved.race)
> and GET_RACE = value
> would express it exactly as your if/else statements. I was trying to
> work out the difference because when you read it out loud, it sounds the
> same heheheheh

ANSI C forbids use of a ternary expression as an lvalue.

So no, it's not quite the same.

bleah..

ch ought to be in parenthesis in that macro.. otherwise, imagine if
someone did something like

foo(struct char_data *asdf)
{
   asdf--;
   {
      int q = GET_RACE(asdf + 1);
   }
}

Ok, so it's not a very good example, heh

-Mysid

--
   +---------------------------------------------------------------+
   | 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