> >As the comments clearly state, its using -1 to represent an
> unused entry,
> >which the compiler turns into an 'all ones' regardless of
> the size of the
> >target unsigned value.
>
> ~0U is the same and of the correct type. Maybe use that?
Yep, this should work better. The other option for "modern" C++ is to use
"std::numeric_limits<unsigned>::max()". This is ANSI-C++ Standard Library
behavior.
Unfortunately "...::max()" is not really appropriate for Xerces-C at this
point, because of the wide range of target platforms (not all of which can
count on a decent C++ Standard Library implementation). However, it is the
right way to go if you need this for other stuff and have the luxury of only
targeting platforms with compilers that have a usable C++ Standard Library
available. Someday we will have a critical mass of wide support for
Standard C++, at which time we can hopefully put many of these ugly, hard to
follow, but functional "C"-era tricks to rest. Until then, you gotta do
what you gotta do... and real men write portable code ;)
- James
James Fowler
Senior Field Architect, Rogue Wave Software
[EMAIL PROTECTED] | 770-218-2571 | mobile: 770-335-3220