[C++-sig] unnamed enum bug

Roman Yakovenko roman.yakovenko at actimize.com
Wed Apr 28 08:33:38 CEST 2004


	Hi. 
> 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;
>   ...
> }

This is almost exactly what I mean. 

scope().attr("CHANNEL_DIRECTION_ENUM_SIZE") = int( CHANNEL_DIRECTION_ENUM_SIZE ); 

The same logic as VarExporter.py. 

> 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?

Yes I tested this and I use this patch in "production", also I quess that there is some
case I failed to test.

Small description: I implemented the same logic as in VarExporter.py.
Also I export unnamed enums as int. The reason is simple: MSVC 7.1
could not compile 
scope().attr("CHANNEL_DIRECTION_ENUM_SIZE") = CHANNEL_DIRECTION_ENUM_SIZE; 
for some reason.

> If everyone agress, I will apply this patch.

I agree :-)

I attach 3 files:
dummy.h - file that includes diferent enums definitions
EnumExporter.py - patched file
diff.txt - the difference between files( CVS version and EnumExporter.py )

Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dummy.h
Type: application/octet-stream
Size: 274 bytes
Desc: dummy.h
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040428/1780a9eb/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: EnumExporter.py
Type: application/octet-stream
Size: 2213 bytes
Desc: EnumExporter.py
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040428/1780a9eb/attachment-0001.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff.txt
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040428/1780a9eb/attachment.txt>


More information about the Cplusplus-sig mailing list