CUDA_VERSION not defined by nvcc

The majority of compilers I’ve encountered (at least the dozen or so general purpose and HPC), I believe, have identification/version macros defined by the compiler itself. In contrast, nvcc does not define the version macro, so checking the version requires #include-ing cuda.h. I found this a rather inconvenient behavior which can backfire and here’s how. The code that does some compiler version dependent stuff, e.g working around bugs:

#if CUDA_VERSION <= SOME.BUGGY.VERSION
  /* need workaround */
#else
  /* no need for the workaround */
#endif

can easily break silently by just removing the #include “cuda.h” thinking that it’s anyway not used - that’s exactly what happened to me.

I would very much like to see nvcc define all its identity macros by default!

Any comments/objections?

(Note that at the same time I am filing a bug report. I’d still like to see as much feedback from developers as possible.)