Le 04/06/2015 15:33, Aaron M. Ucko a écrit : > I would suggest (unconditionally) extending Gyoto::Property with > get_size_t and and set_size_t methods, and redefining > GYOTO_PROPERTY_SIZE_T accordingly. > > Could you please take a look?
Dear Aaron, Unconditionally, this will not work, at least the way Property is supposed to work: on 64-bit arches, the compiler will not be able to distinguish the two distinct constructors for unsigned long and size_t because it really is the same. Besides, I'd rather not break the ABI already. I could extend Property with new typedefs, accessors and constructors for size_t only for the architectures that need it, but I don't know how to determine this automatically. There is a solution that appears to be working but relies on undefined behaviour. I can also extend the test suite to make sure it actually does the right thing (I've tested manually under i386 already). Do you see a real-world case in which this will fail: /// Define a Property of type Long #define GYOTO_PROPERTY_SIZE_T(class, name, fname) \ Gyoto::Property \ (#name, \ reinterpret_cast<Gyoto::Property::set_unsigned_long_t>((void (Object::*)(size_t val))&class::fname), \ reinterpret_cast<Gyoto::Property::get_unsigned_long_t>((size_t (Object::* )() const)&class::fname)), Kind regards, Thibaut. -- * Dr Thibaut Paumard | LESIA/CNRS - Table équatoriale (bât. 5) * * Tel: +33 1 45 07 78 60 | Observatoire de Paris - Section de Meudon * * Fax: +33 1 45 07 79 17 | 5, Place Jules Janssen * * [email protected] | 92195 MEUDON CEDEX (France) *
smime.p7s
Description: Signature cryptographique S/MIME

