Re: Paying developers to get features faster

From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 01/24/04

  • Next message: Matt Palmer: "Re: Paying developers to get features faster"
    Date: Sat, 24 Jan 2004 01:56:45 GMT
    
    

    In article <k33310hjf6f2j8k3qmbtfsvg242tps7cm2@4ax.com>,
     Brad Olin <bwo@bwo1.com> wrote:

    > >I might be thinking silly here but why not write
    > >
    > ><var> = <expression>;
    > >if (<var>) ....
    > >
    >
    > Actually, it should have been coded as...
    >
    > if ((<var> = <exp>) != 0)
    >
    > and your solution should be coded as...
    >
    > <var> = <exp>;
    > if (<var> != 0)
    >
    > The ANSI C language assumes a non-zero compare by default. All you are
    > trying to do here is to remove the assumption and confirm your compare
    > statement. There are strict C compilers (not gcc) that would complain
    > about your solution. They are a pain in the but to work with, but
    > probably worth it in the long run.

    Why? The style:

    if (<var>) ...

    is *extremely* common. Any compiler that warns about it will produce
    volumes of warnings for thousands of perfectly fine programs. Any C
    programmer who considers this poor style is way out of the mainstream.
    I can't imagine these C compilers being very popular.

    -- 
    Barry Margolin, barmar@alum.mit.edu
    Arlington, MA
    *** PLEASE post questions in newsgroups, not directly to me ***
    

  • Next message: Matt Palmer: "Re: Paying developers to get features faster"

    Relevant Pages

    • Re: Paying developers to get features faster
      ... > The ANSI C language assumes a non-zero compare by default. ... programmer who considers this poor style is way out of the mainstream. ... I can't imagine these C compilers being very popular. ...
      (comp.os.linux.misc)
    • Re: Paying developers to get features faster
      ... > The ANSI C language assumes a non-zero compare by default. ... programmer who considers this poor style is way out of the mainstream. ... I can't imagine these C compilers being very popular. ...
      (comp.os.linux.development.system)
    • Re: Paying developers to get features faster
      ... > The ANSI C language assumes a non-zero compare by default. ... programmer who considers this poor style is way out of the mainstream. ... I can't imagine these C compilers being very popular. ...
      (comp.os.linux.security)
    • Re: replacing builtin_expect with normal code
      ... > Compilers and libraries have to deal with legacy code, ... > struggling with had written it in standard C you wouldn't have the ... I can see how unix libraries etc have evolved... ... nrand48is not part of the ansi C standard. ...
      (comp.lang.c)
    • Re: Looking for gen symm sparse eigensolver in C or C++
      ... Maybe it is just a quirk of the wording, but I fail to understand the "anymore" as applied to ANSI C in the above sentence. ... Conformance to the ANSI standard is not changed by compilers undergoing revision. ... If I read what it literally, then it says that the code was once ANSI C compliant, but that a revision of the ANSI C standard introduced an incompatibility so that the code is not compliant with the current version of the standard and thus doesn't compile on compilers conforming to the current standard. ... In subsequent years, the conformance increased and the compilers became more strict in it's adherance and the older version source, having never been updated accordingly, stopped being compilable anymore. ...
      (comp.lang.fortran)