[GCC-XML] Should I ever get two "ids" that are the same?

Brad King brad.king at kitware.com
Tue Nov 2 18:29:20 EST 2004


John Morrison wrote:
> Sorry if this is another stupid newbie question.  Should I expect each
> id in a given run of gccxml to be unique?
> 
> I was using a hash table to save the XML parse nodes in, and was quite
> surprised to get a collision (you can blame a fit of programmer
> paranoia for the collision check).
> 
> Is this expected?  (I am hoping it's not expected, as I use the ids as
> unique identifiers by which the associated node can be unambiguously
> reffered to.)

The id values are part of the ID/IDREF attributes specification for XML 
and therefore must be unique.  If you are getting a collision in the 
hash table it is probably because your hash function maps two ids to the 
same place.  If you really see two elements in the XML output with the 
same id then it is probably a bug and you should post it.

-Brad



More information about the gccxml mailing list