Code that's specific to a given platform typically needs headers for
that platform. And these headers are typically not available when the
code is compiled on another platform. This means that some selection of
which code to compile is needed anyway, and I would think that then the
above technique becomes just an added complication, redundant.
As I understand it inline namespaces (I haven't used them) were designed
to support versioning for template code, where client code may need to
specialize templates in their apparent original namespaces.
Three main ways of selecting which code to compile:
• conditional code blocks via `#if` and family,
• selection of headers via the compiler's include path, and
• creating a platform (or whatever-) specific code bundle by a tool that
picks that platform's files.
In addition it's technically possible to select headers via macro-based
include directives, but I tried that once and it quickly became a real
mess, running up against compiler and compiler version differences and
non-standard functionality.
Anyway, instead of using a macro to redefine a word like lowercase
"platform" that can easily be used for other purposes somewhere, I'd use
more obviously macro macros, with ugly all uppercase names, to let the
compiler see just one “inline”. But then we're into selecting which code
to compile again. Which seems to make this redundant.
Cheers & hth.,
- Alf