On Sun, 30 Jul 1995, mud admin staff wrote:
> > if (GET_ROOM_SPEC(ch->in_room) != NULL)
> > couldn't the same thing be accomplished with this? :
> > if (GET_ROOM_SPEC(ch->in_room))
>
> yes on most systems, but I have come across documentation that swore that NULL
> is not aways == 0. Who ever coded the first like Probably had read some of it
> also.
no, it is the same on _every_ ANSI-C Compiler, and on any other known
C-Compilers too.
Maybe you just have missread these documentations. NULL must be 0, but
NULL needn't to be "binary" 0.
>
> > I've noticed statements like the first one in lots of places in the circle
> > code. Wouldn't the program be slightly smaller with the second statment?
>
> If you ever look at the assembly out put of most good compilers they catch it
> right away... and use them as the equivaltent. GCC only does with the -O flag
> or better. (Linux version that I can be soure of)
>
Nonsense. =)
You really get the same assembly output with both versions.
Actually it's just a question of coding style. Some people want to make sure
everybody notices the type of a variable on the first look, so they write
NULL whenever possible, to show it's a pointer.
All you can achieve is a few bits less of source code. :)
Personally i use the shorter form too, because it seems better readable
to me, but thats only my personal point of view, which is not shared by
too many people.
Herbert
[on public request 12 lines of signature deleted] *snip* ;)