apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk-Willem van Gulik <di...@covalent.net>
Subject Re: cvs commit: apr/network_io/unix sendrecv.c
Date Fri, 04 May 2001 00:19:04 GMT

You two guys might violently agree :-)

Asserts - when used properly - are very usefull tools to check for
conceptional bugs, But you should always assume that you compile for
production with the -NA, -DNDEBUG, -NOASSERT or your local relevant flags.

Production code which relies on assert()s are capital bad.

As long as that is our premisse :-)

Dw

On Thu, 3 May 2001 rbb@covalent.net wrote:

>
> > >   Index: sendfile.c
> > >   ===================================================================
> > >   RCS file: /home/cvs/apr/test/sendfile.c,v
> > >   retrieving revision 1.12
> > >   retrieving revision 1.13
> > >   diff -u -r1.12 -r1.13
> > >   --- sendfile.c	2001/03/31 22:37:13	1.12
> > >   +++ sendfile.c	2001/05/03 22:37:58	1.13
> > >   @@ -373,6 +373,7 @@
> > >                printf("apr_sendfile()->%d, sent %ld bytes\n", rv, (long)tmplen);
> > >                if (rv) {
> > >                    if (APR_STATUS_IS_EAGAIN(rv)) {
> > >   +                    assert(tmplen == 0);
> > >                        nsocks = 1;
> > >                        tmprv = apr_poll(pfd, &nsocks, -1);
> > >                        assert(!tmprv);
> >
> > No assert should ever be present in server code, period.  I don't care if
> > the only way it could be triggered is by a cosmic ray hittng a memory cell
> > at just the wrong moment in time, it doesn't belong in the server code.
> >
> > Either check the error condition or be prepared to ignore it.
>
> We have asserts throughout the server these days.  Do we want to remove
> them all?
>
> Ryan
>
> _______________________________________________________________________________
> Ryan Bloom                        	rbb@apache.org
> 406 29th St.
> San Francisco, CA 94131
> -------------------------------------------------------------------------------
>
>


Mime
View raw message