Assertion failed, attempting to add intrusive link...

Article ID: 830
Last updated: 05 Feb, 2008
Article ID: 830
Last updated: 05 Feb, 2008
Revision: 1
Views: 8747
Posted: 12 Aug, 1997
by Dean J.
Updated: 05 Feb, 2008
by Dean J.
Problem


You get an assertion at runtime that looks something like:

Assertion failed: (RWIsvDlist::insertAfterLink(RWIsvDlink*, RWIsvDlink*): Attempt to add intrusive link to more than one list. (NOTE: May be caused by not defining RWDEBUG when compiling modules to be linked with debug version of library.) , (a->next_==0) !=0), file idlist.cpp, line 308


Cause


Many of the Tools.h++ collection classes rely on intrusive linked lists to implement their functionality. A few examples are RWTPtrDlist, RWTValSlist, and RWTPtrHashDictionary.

An intrusive link can only be a member of one list at a time. Since this property can only be checked at runtime, assertions are used to make sure this property is not violated.

In the debug build of the Tools.h++ library, the instrusive linked list class will provide membership checking at runtime. If the RWDEBUG macro is not defined, then the check variable is not initialized. When the contents of this variable is inspected and found not to contain the expected value, an assertion is generated.


Action


Define the RWDEBUG macro at application scope.

Most compiler IDEs have an entry field (somtimes labeled Defines or Preprocessor Definitions) that allows you to define macros at application scope.

For command line or makefile builds:

-DRWDEBUG=1


This macro should not be defined for projects that use the release build of the Tools.h++ library.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 830
Last updated: 05 Feb, 2008
Revision: 1
Views: 8747
Posted: 12 Aug, 1997 by Dean J.
Updated: 05 Feb, 2008 by Dean J.

Others in this category