Open ndmitchell opened 7 years ago
Adding a hexml_ prefix is pure win.
There were good reasons for the int
thing originally - you could pass a string which was not null terminated, and use the length. Or you could pass a string that was null terminated, and it wouldn't ever look for the trailing zero in advance, it emerged as a consequence of the operation, so saved you a string walk. As it stands, there's little reason for the -1 nastiness, and thus size_t
makes more sense.
I have prefixed all exported functions with hexml_ and added static annotations to the rest. Should I also be mangling the types? e.g. hexml_str? Should it really be hexml_str_t by convention?
Regarding signed operations - I am using int32_t in the str
data type since I want to use less memory, and the document is essentially just str
data types. It seems like that should really be uint32_t. For length of the string, size_t is plausible, but for most other contexts should I be using size_t? unsigned? uint32_t? What should I be doing by default, and what should I be converting to/from at the edges?
@thoughtpolice in https://www.reddit.com/r/haskell/comments/5i2mg1/new_xml_parser_hexml/db5os2h/ says: