S
Simon Elliott
I'm porting thousands of lines of legacy C code to C++. One makor issue
I've got is that of enums being treated differently in C and C++.
There's an automatic cast from int to enum in C but not in C++. The
code is full of constructs like this:
enum { CARROT=0x01,TURNIP=0x02,PARSNIP=0x04,SPROUT=0x08 } garden_veg;
garden_veg = CARROT|PARSNIP; /* Fine in C, but not in C++ */
Do I really have to trawl through all this code and put in many
hundreds of casts, or is there something clever I can do to get round
this?
I've got is that of enums being treated differently in C and C++.
There's an automatic cast from int to enum in C but not in C++. The
code is full of constructs like this:
enum { CARROT=0x01,TURNIP=0x02,PARSNIP=0x04,SPROUT=0x08 } garden_veg;
garden_veg = CARROT|PARSNIP; /* Fine in C, but not in C++ */
Do I really have to trawl through all this code and put in many
hundreds of casts, or is there something clever I can do to get round
this?