At the moment, I'm limited to using a Visual Studio 2010 for a project, but will be able to switch to VS 2015/Express/whatever in the near future. As such, I'm making the code forwards-compatible with C++11 features VS2010 doesn't support via #ifdef
/#else
/#endif
blocks, so I can update things quickly once I can switch. This works fine and all, but I want to make sure this isn't considered bad practice or anything:
// Constants, for forwards compatibility.
#ifdef STUDIO_2010
typedef const int constint;
#else /* STUDIO_2010 */
using constint = constexpr int;
#endif /* STUDIO_2010 */
constint const1 = 0;
// etc.
Edit: Sorry for any confusion, I mistyped. It's about const int
vs. constexpr int
, not typedef styles. Fixed now.
Aucun commentaire:
Enregistrer un commentaire