Suppose there is a C ++ 11 API that uses enumeration classes:
Now suppose I would like to use this API, but I don't have a C ++ 11 compiler. So, I:
- Modify
api.hpp
and change the enum class to a simple enumeration. - Write code that includes the modified
api.hpp
and usually uses an API (e.g. f
calls). - Compile this code with my non-C ++ 11 compiler and bind it to an API implementation that was compiled using the C ++ 11 compiler (using unmodified
api.hpp
).
This seems to work with GCC, but is it safe at all, or am I playing with fire (ODR violations, etc.)?
Suppose two compilers are generally compatible with channels, this is only the enum vs. class enum.
source share