Re: wait state

From: Brian Gray (gray@sportsline.com)
Date: 11/02/99


At 07:59 PM 11/2/99 +0000, Nocturnal Occulto wrote:
>#define WAIT_STATE(ch, cycle) do { GET_WAIT_STATE(ch) = (cycle); }
>while(0)
>
>Curious whats the point with the do/while thing, why not just a simple
>GET_WAIT_STATE(ch) = (cycle); ?

It's just a trick to get the macro to look more like a function.  All it
really does is force a semicolon at the end of the line.  In this case it's
not needed since there's only one line to the macro (could be
(GET_WAIT_STATE(ch) = (cycle))), but in multi-line blocks, it gets treated
as a single line of code.  Thus...

WAIT_STATE(ch, cycle);

...works no matter the implementation of the macro.


Brian Gray
Systems Programmer/Analyst
Broadband Technologies
SportsLine.com
(954)351-2120 x862


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



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