emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: constant `e'


From: Stuart D. Herring
Subject: Re: constant `e'
Date: Mon, 12 Feb 2007 11:03:50 -0800 (PST)
User-agent: SquirrelMail/1.4.8-2.el3.7lanl

> Hm!  That's interesting.
>
> The concept of `non-nil' is very basic to me, so I do not
> have to filter anything out of `(not (null ...))', because
> it is already phrased the way I think about it.

I have addressed this point more extensively in another mail, but let me
add in response to this particular sentence that the concept of `non-nil'
is so very basic to me that I do not need to see `(not (null ...))' to
know that it is applied by such forms as `cond'.

> I had no idea some people read it like that.
>
> Do you feel similarily talked down to when you see C code
> like the following?
>
>    for (node = list->first; node != NULL; node = node->next)
>      process (node);

I don't feel talked-down-to as much as I feel inconvenienced by (if you'll
pardon the exaggeration) the ineffective prose of a novice.  The use of
NULL when even the compiler merely sees 0 in its stead serves no purpose
in terms of type-safety, and after resolving that mentally I also waste
more time noting that `!=0' does not affect the conditional value of an
integer or pointer.

Although it would be clumsy here, I would even recommend, since the loop
is so simple, that a trivial loop over argv be written as

for(ptr=argv;*ptr;process(*ptr++));

Some would say that this is appropriate only for the IOCCC, but I tend to
consider it actually clearer: the use of the construct *ptr++ can only
have the meaning of "use and advance past an element", and the test *ptr
can only mean "this is a null-terminated array".  So, without any further
contemplation, I can assume that this must be a loop to process -- once --
each element of a null-terminated array.

If it is really so cryptic, adding /* process() each argument */ will
alleviate any confusion without, as more verbose code might, causing
anyone who "got it" the first time to have to doubt themselves and
re-read.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]