Hi David,
At 08.45 24/07/2007 -0700, David Bertoni wrote:
Scott Cantor wrote:
Another point regarding this is that when you use native types, people glue
APIs and components together based on the fact that both APIs use those
types. Then you have a brittle contract because neither component *meant* to
promise that they would work together through the native type. Using a
typedef prevents people from overestimating what they can combine together
safely, since it requires a cast.
Wow, I didn't realize I would create so much controversy here! ;-)
I have to agree with most others that the distinction between the
size of a "memory buffer" and the number of items in a container
seems arbitrary.
Also, the "length" of a UTF-16 string in Xerces-C, which is now
expressed in XMLSize_t is _not_ the size of a memory
buffer. Rather, it is the number of UTF-16 code units, which
doesn't seem much different to me than the number of attributes in a
document, or the number of items in a container. After all, isn't
it all about "counting" things?
Well, every number is expressing a "count" of something ;-)
What I have in mind could be expressed also in this way: a
size_t/XMLSize_t has a meaning only when given a starting address,
i.e. it's part of a tuple (void*, size_t), while an unsigned
int/unsigned long can be treated as a standalone number, i.e. X
attributes, Y lines.
Finally, I have to agree with Scott that a typedef would be
better. You've no idea the number of changes I had to make in
Xalan-C for compatibility with the Xerces-C changes to
XMLSize_t. Luckily, about 5 years ago, we started using typedefs
extensively, or I would have had to make many more changes.
Switching from philosophical to practical (not that being
philosophical is necessary a bad thing), is this a request to add new typedefs?
E.g.: XMLCount_t, XMLLineCol_t, others...?
What about those APIs that currently return 'int' because they use -1
to signal 'not found'?
Alberto
Thanks!
Dave
---------------------------------------------------------------------
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]