In article <43******@griseus.its.uu.se>, Jan Danielsson <ja************@gmail.com> writes:
I'm writing an XML parser, and I'd like to know how portable a
solution is.
When I pass an STag or EmptyElement tag to the application, I
(obviously) need to pass the attribute list somehow. I thought about
storing the list in something like this:
typedef struct _ATTRLIST
Others have already discussed the "struct hack", but note also that
identifiers beginning with an underscore followed by an uppercase
letter are always reserved to the implementation. You cannot
portably use the struct tag "_ATTRLIST" for your own structure.
Similarly, any identifier that begins with an underscore is reserved
at file scope. Best bet: don't begin your identifiers with under-
scores. C90 7.1.3.
(Personally, I don't see why you use both a struct tag and a typedef,
since the struct doesn't contain a pointer to the same struct type.
My preference is to avoid typedef in nearly all situations, and
particularly to not disguise a pointer type using typedef, but those
are questions of style. Also, I avoid identifiers in block capitals;
some like to reserve those for macro names, but I use mixed case for
all identifiers as I've found that reduces the likelihood of name
collisions in the environments where my code is typically compiled.
That too is a style issue, of course.)
--
Michael Wojcik
mi************@microfocus.com
It does basically make you look fat and naked - but you see all this stuff.
-- Susan Hallowell, TSA Security Lab Director, on "backscatter" scanners