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):#inc
lude <assert.h>
D:\ivan\download\DOM\xerces-c-src1_4_0\src\dom\DOM_DocumentType.cpp(105):
//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):#include
<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(76)
:#define TASSERT(c) tassert((c), __FILE__, __LINE__)
D:\ivan\download\DOM\xerces-c-src1_4_0\tests\DOM\DOMIDTest\DOMIDTest.cpp(78)
: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(83)
:#define TASSERT(c) tassert((c), __FILE__, __LINE__)
D:\ivan\download\DOM\xerces-c-src1_4_0\tests\DOM\RangeTest\RangeTest.cpp(85)
:void tassert(bool c, char *file, int line)
D:\ivan\download\DOM\xerces-c-src1_4_0\tests\DOM\Traversal\Traversal.cpp(94)
:#define TASSERT(c) tassert((c), __FILE__, __LINE__)
D:\ivan\download\DOM\xerces-c-src1_4_0\tests\DOM\Traversal\Traversal.cpp(96)
: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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]