[antlr-interest] C Runtime - list container suggestions

Cameron Esfahani dirty at apple.com
Mon Aug 13 15:17:32 PDT 2007


Jim,
I've noticed two problems with the antlr3List "class" in  
antlr3collections.c:

- Nearly all of the routines take a "key" parameter: get, put, delete  
and remove.  But, the add routine doesn't return a key.  After  
calling add, there is no way to determine where in the list the  
element was put.

- The list uses the size of the hash as it's key.  This is a problem  
if elements are removed from the list.  You will get hash  
collisions.  In my case, I did the following operations:
	add
	add
	add
	delete first add
	delete second add
	add

then the next add would return an error because it would hash to the  
same value.

Cameron Esfahani
dirty at apple.com

"With or without religion, good people can behave well and bad people  
can do evil; but for good people to do evil - that takes religion."

Steven Weinberg



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070813/dceedec1/attachment.html 


More information about the antlr-interest mailing list