nmh-workers
[Top][All Lists]
Advanced

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

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


From: Paul Vixie
Subject: Re: [Nmh-workers] proposed patch for shell metacharacter failure in nmh-1.7
Date: Sun, 14 Jan 2018 22:04:38 -0800
User-agent: Postbox 5.0.22 (Windows/20171208)



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




reply via email to

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