Re: [PATCH] Fix compilation warnings in test/smtp-dummy.c.

Subject: Re: [PATCH] Fix compilation warnings in test/smtp-dummy.c.

Date: Tue, 21 Jun 2011 14:59:04 -0700

To: Dmitry Kurochkin, notmuch@notmuchmail.org

Cc:

From: Carl Worth


On Thu, 16 Jun 2011 14:32:08 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> * Remove unused variables in main(): buf, bytes and greeting.
> * Replace return with no value in main() with exit(3).

Thanks. I'd notice these occasionally when running the test suite and
had meant for some time to fix them. But when doing my typical
compilation within emacs, (with just "make"), I wouldn't get these
warnings so I wasn't cleaning these in my typical work to make the
compilation error/warning-free.

I did follow up with a commit to prefer return (with a value) over
exit(), which I applied throughout the main() function:

commit b1aa676cca01ce0d907d220dc3c3a5142991c1cf
Author: Carl Worth <cworth@cworth.org>
Date:   Tue Jun 21 14:54:10 2011 -0700

    smtp-dummy: Prefer return rather than exit() in main.
    
    The main() function should be written as just another function with a
    return value. This allows for more reliable code reuse. Imagine that
    main() grows too large and needs to be factored into multiple
    functions. At that point, exit() is probably the wrong thing, yet can
    also be hard to notice as it's in less-frequently-tested exceptional
    cases.


-Carl

-- 
carl.d.worth@intel.com
part-000.sig (application/pgp-signature)

Thread: