I put many of those asserts in there.

Some of them are checking for internal consistency problems -
if they fail they indicate a bug in the implementation, not
a user error.  For these cases, assert seems OK - they are
essentially a debugging aid and don't want to be in the
release code at all.  And aren't, because of the way that
assert is defined.

Any asserts that check conditions that may be caused by user
(application) code, or bad user data, should be replaced
by some other sort of error signalling.

The TASSERT test macro is a whole different thing, and has
nothing in common with the c library assert().  TASSERT does
lots of good stuff, and needs to stay.  It is the primary error
reporting mechanism for some of the test programs, and is
not used anywhere but in test programs.

Andy Heninger
IBM, Cupertino, CA
[EMAIL PROTECTED]


----- Original Message -----
From: "Dean Roddey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 10:48 PM
Subject: Re: asserts in Xerces


> I think that it was always agreed that those asserts should be dealt
with,
> since that's not the way the rest of the system works. I think that the
> original C++ DOM code was inherited with those in there?
>
>
> ----- Original Message -----
> From: "Uthus Ivan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, March 27, 2001 10:41 PM
> Subject: RE: asserts in Xerces
>
>
> > Aren't there anyone who would like to comment on this issue ?  What
are
> the
> > thoughts on asserts vs exceptions in Xerces for example ?
> >
> > Ivan
> >
> > -----Original Message-----
> > From: Uthus Ivan [mailto:[EMAIL PROTECTED]]
> > Sent: 26. mars 2001 10:54
> > To: '[EMAIL PROTECTED]'
> > Subject: asserts in Xerces
> >
> >
> > Hi!
> >
> > We have had some problems in our production environment with the
> (prebuilt)
> > Xerces lib version 1.4 for AIX 4.2.  On some large (5.4 MB) files, the
lib
> > asserts at this location in NodeVector.cpp:
> > void NodeVector::init(unsigned int size) {
> > assert(size > 0);
> > data = new NodeImpl *[size];
> > assert(data != 0);
> > allocatedSize = size;
> > nextFreeSlot = 0;
> > };
> >
> > Why aren't the AIX 4.2 a production build ?  (OK, in this code, maybe
> assert
> > is the best way to handle the problems, since the alternative would be
a
> > segfault or something like that at a later stage, but asserts in
> production
> > code are generally a no-no).  I found asserts at the following places
in
> the
> > code:
> > Searching for 'assert'...
> >
D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\DOMString.cpp(157):#include
> > <assert.h>
> > D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\DOMString.cpp(280):
> > assert(sizeToAlloc == sizeof(DOMStringHandle));
> > D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\DOMString.cpp(524):
> > assert(nullValue == 0);
> > D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\DOMString.cpp(557):
> > assert(arg == 0);
> >
>
D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\DOM_DocumentType.cpp(92):#i
nc
> > lude <assert.h>
> >
D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\DOM_DocumentType.cpp(105):
> > file://Note: the assert below has no effect in release build
> >
D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\DOM_DocumentType.cpp(107):
> > assert(nullPointer == 0);
> >
D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\DOM_Node.cpp(99):#include
> > <assert.h>
> >
>
D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\DOM_NodeList.cpp(84):#inclu
de
> > <assert.h>
> >
D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\NodeVector.cpp(96):#include
> > <assert.h>
> > D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\NodeVector.cpp(109):
> > assert(size > 0);
> > D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\NodeVector.cpp(111):
> > assert(data != 0);
> > D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\NodeVector.cpp(135):
> > assert(newData != 0);
> > D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\NodeVector.cpp(162):
> > assert(index <= nextFreeSlot);
> > D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\NodeVector.cpp(175):
> > assert(index < nextFreeSlot);
> > D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\NodeVector.cpp(187):
> > assert(index < nextFreeSlot);
> >
>
D:\ivan\download\DOM\xerces-c-src1_4_0\tests\DOM\DOMIDTest\DOMIDTest.cpp(7
6)
> > :#define TASSERT(c) tassert((c), __FILE__, __LINE__)
> >
>
D:\ivan\download\DOM\xerces-c-src1_4_0\tests\DOM\DOMIDTest\DOMIDTest.cpp(7
8)
> > :void tassert(bool c, char *file, int line)
> >
>
D:\ivan\download\DOM\xerces-c-src1_4_0\tests\DOM\DOMMemTest\DOMMemTest.cpp
(8
> > 0):#define TASSERT(c) tassert((c), __FILE__, __LINE__)
> >
>
D:\ivan\download\DOM\xerces-c-src1_4_0\tests\DOM\DOMMemTest\DOMMemTest.cpp
(8
> > 2):void tassert(bool c, char *file, int line)
> >
>
D:\ivan\download\DOM\xerces-c-src1_4_0\tests\DOM\RangeTest\RangeTest.cpp(8
3)
> > :#define TASSERT(c) tassert((c), __FILE__, __LINE__)
> >
>
D:\ivan\download\DOM\xerces-c-src1_4_0\tests\DOM\RangeTest\RangeTest.cpp(8
5)
> > :void tassert(bool c, char *file, int line)
> >
>
D:\ivan\download\DOM\xerces-c-src1_4_0\tests\DOM\Traversal\Traversal.cpp(9
4)
> > :#define TASSERT(c) tassert((c), __FILE__, __LINE__)
> >
>
D:\ivan\download\DOM\xerces-c-src1_4_0\tests\DOM\Traversal\Traversal.cpp(9
6)
> > :void tassert(bool c, char *file, int line)
> > 24 occurrence(s) have been found.
> >
> > So DOMString, NodeVector and DOM_DocumentType are files that might be
> > changed into throwing an exception or something...
> >
> > Regards,
> > Ivan Uthus
> > EDB Fellesdata as
> >
> >
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to