Re: quick question.

From: Herbert Kremser (kremser@flinux.tu-graz.ac.at)
Date: 07/31/95


On Mon, 31 Jul 1995, Jeremy Elson wrote:

> >   if (GET_ROOM_SPEC(ch->in_room) != NULL)
> > 
> >   if (GET_ROOM_SPEC(ch->in_room))
> 
> Yes, the statements are the same.  However I often choose the first
> because it's clearer when someone not familiar with C is reading it.
> 
> Note that there are many, many places in the code -- the if (x != 0)
> case that you pointed out being only one out of a hundred examples --
> where I've chosen to code something in a way that is maximally readable
> and understandable, rather than maximally efficient or maximally
> compact.
> 

Hmm, am i alone in reading the code in sentences like

if (GET_ROOM_SPEC(ch->in_room) != NULL)
if there is a special procedure which is unequal to a non-existing
special procedure ...

if (GET_ROOM_SPEC(ch->in_room))
if there is a special procedure ...

Ok, i didn't find many which agree with me, in 2nd version beeing more
readable, but i still like it.  :)

Another thing where i have a different point of clear, readable coding
is the IS_NPC macro. Ok, double negate shouldn't be a prob, but though
if i have longer boolean constructs i tend to mix myself up.  :)
So i changed all !IS_NPC  to IS_PC, since  "is not non playing character"
seems more readable to me than "is playing character".

But again, i'm rather alone in these topics.

Herbert

[on public request 12 lines of signature deleted]  *snip* ;)



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