Okay, I am convinced. :) If Martin does not object, I would change the "void *str" field to
union { void *any; unsigned char *latin1; Py_UCS2 *ucs2; Py_UCS4 *ucs4; } data; Regards, Torsten On Wed, Aug 24, 2011 at 02:57, Stefan Behnel <stefan...@behnel.de> wrote: > Torsten Becker, 24.08.2011 04:41: >> >> Also, common, now simple, checks for "unicode->str == NULL" would look >> more ambiguous with a union ("unicode->str.latin1 == NULL"). > > You could just add yet another field "any", i.e. > > union { > unsigned char* latin1; > Py_UCS2* ucs2; > Py_UCS4* ucs4; > void* any; > } str; > > That way, the above test becomes > > if (!unicode->str.any) > > or > > if (unicode->str.any == NULL) > > Or maybe even call it "initialised" to match the intended purpose: > > if (!unicode->str.initialised) > > That being said, I don't mind "unicode->str.latin1 == NULL" either, given > that it will (as mentioned by others) be hidden behind a macro most of the > time anyway. > > Stefan _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com