nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] proposed patch for shell metacharacter failure in nmh-1.7

2018-01-15 00:04:52


Ken Hornstein wrote:
That's not right, it should be:

      while ((pp = strchr (pp, '\''))&&   buflen>   3) {
pointers aren't booleans. in BSD style as used in BIND, this would be:

while ((pp = strchr(pp, '\'')) != NULL&&  buflen>  3) {

Forgive my stupidity ... but this is just a matter of style, correct?
AFAIK, there is no problem from a language perspective.  If there is a
problem from the language perspective, I would like to understand it.

the same underlying machine code will be generated.

however, it is both clearer, and also, more likely to generate a compiler error at least a warning, if our assumptions are wrong.


(I am neutral on the style issue, myself).

i came to C from PDP-11 assembler, and so anything that sets the condition codes could be used for a subsequent branch-if instruction, and so i used to write "if (thing1) thing2" because i "knew" that no test instruction was needed. later we got -Wall -Werror; i changed.

i would rather give the compiler an extra chance to yell at me. pointers aren't booleans, in spite of C's ability to treat them that way. i had this fight with keith bostic when we integrated Cron into 4.4, and he won, and he was right.

--
P Vixie


--
Nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>