Hi. I know that this issue was raised a few month ago. I want to come back to this issue. The reason is simple: I found bug in pyste. Description: in header file I have 2 or more unnamed enums. namespace shared_consts{ enum{ CHANNEL_DIRECTION_ENUM_SIZE = 3 }; enum{ CHANNEL_FIELD_TYPE_ENUM_SIZE = 3 }; } After generation I get next code enum_< py::UniqueInt<-1292127665> >("unnamed") .value("CHANNEL_DIRECTION_ENUM_SIZE", shared_consts::CHANNEL_DIRECTION_ENUM_SIZE) .export_values() ; enum_< py::UniqueInt<-1292127665> >("unnamed") .value("CHANNEL_FIELD_TYPE_ENUM_SIZE", shared_consts::CHANNEL_FIELD_TYPE_ENUM_SIZE) .export_values() ; As you can see there is an attempt to register same class enum_ twice, every time with different definition. I am working with boost 1.31 and pyste from CVS. ( I get assertion error in registry.cpp file, registry::insert function ) Why we could not export unnamed enums as constants ? This will also solve other small problem - repeating definition of "template<int num> struct UniqueInt" each time pyste meats unnamed enum. I already have patch for doing this. Roman
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 26 Apr 2004 at 9:03, Roman Yakovenko wrote:
Why we could not export unnamed enums as constants ?
How do you mean?
This will also solve other small problem - repeating definition of "template<int num> struct UniqueInt" each time pyste meats unnamed enum. I already have patch for doing this.
pyste should be incrementing the number for each anonymous enum declared. OTOH it should also be a positive number, I've never seen a negative number myself. Cheers, Niall -----BEGIN PGP SIGNATURE----- Version: idw's PGP-Frontend 4.9.6.1 / 9-2003 + PGP 8.0.2 iQA/AwUBQI1pW8EcvDLFGKbPEQJERgCgnrI+amgS7RTnBeR628xYpRHrYckAoNV5 uWEfaSl4GTqFIaeiMh+coC0X =0ePm -----END PGP SIGNATURE-----
Hi Roman and Niall, Niall Douglas wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 26 Apr 2004 at 9:03, Roman Yakovenko wrote:
Why we could not export unnamed enums as constants ?
How do you mean?
I guess Roman means to put a constant with the same value in the global scope, something like this (untested): { scope unnamed; unnamed.attr("CHANNEL_DIRECTION_ENUM_SIZE") = CHANNEL_DIRECTION_ENUM_SIZE; ... } I'm not sure if everything just "works", but if it does, I guess that change is good enough to me. Note that normal enums are exported as usual. Roman, have you tested this? How does it work? If everyone agress, I will apply this patch. Regards, Nicodemus.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 26 Apr 2004 at 21:18, Nicodemus wrote:
unnamed.attr("CHANNEL_DIRECTION_ENUM_SIZE") > CHANNEL_DIRECTION_ENUM_SIZE; ...
I'm not sure if everything just "works", but if it does, I guess that change is good enough to me. Note that normal enums are exported as usual. Roman, have you tested this? How does it work?
Definitely nicer than my UniqueInt solution.
If everyone agress, I will apply this patch.
Ooo, does this mean your long-awaited return to enhancing pyste is about to start (it is nearly the summer!)? Cheers, Niall -----BEGIN PGP SIGNATURE----- Version: idw's PGP-Frontend 4.9.6.1 / 9-2003 + PGP 8.0.2 iQA/AwUBQI3TpsEcvDLFGKbPEQIAfwCeMxnMAL8+huP+tIU1DoJ1cERqpkoAoINZ fa2/p1uBY6fg0Q2zFCrSbXZ2 =h4Rk -----END PGP SIGNATURE-----
participants (3)
-
Niall Douglas -
Nicodemus -
Roman Yakovenko