This sucks really. I added another enum overload:
typedef enum fpl_KeyboardModifierType {
fpl_KeyboardModifierType_None = 0,
fpl_KeyboardModifierType_Alt = 1 << 0,
fpl_KeyboardModifierType_Ctrl = 1 << 1,
fpl_KeyboardModifierType_Shift = 1 << 2,
fpl_KeyboardModifierType_Super = 1 << 3,
} fpl_KeyboardModifierType;
#ifdef __cplusplus
inline fpl_KeyboardModifierType operator |(fpl_KeyboardModifierType a, fpl_KeyboardModifierType b) {
return static_cast<fpl_KeyboardModifierType>(static_cast<int>(a) | static_cast<int>(b));
}
inline fpl_KeyboardModifierType operator &(fpl_KeyboardModifierType a, fpl_KeyboardModifierType b) {
return static_cast<fpl_KeyboardModifierType>(static_cast<int>(a) & static_cast<int>(b));
}
inline fpl_KeyboardModifierType& operator |=(fpl_KeyboardModifierType& a, fpl_KeyboardModifierType b) {
return a = a | b;
}
#endif
and now i get this:
Error C2733 'operator |': second C linkage of overloaded function not allowed
Error C2733 'operator &': second C linkage of overloaded function not allowed
Error C2733 'operator |=': second C linkage of overloaded function not allowed
I am nearly at a point, where i just want to throw of all enums and use just a struct with an uint32 value and use simple defines - so i get type checking at least for the argument type...
People who saying "Almost all legacy C code can be compiled with a C++ compiler" are just lying, because even this simple thing wont compile -.- I see why other C libraries dont use enums at all...