Date: Fri, 3 Nov 2023 09:43:43 +0200
Michael Spencer via SG15 <sg15_at_[hidden]> writes:
> This paper makes the following ill-formed by forbidding macro expansion
> in the name of module declarations.
>
> version.h:
> #ifndef VERSION_H
> #define VERSION_H
>
> #define VERSION libv5
>
> #endif
>
> lib.cppm:
> module;
> #include "version.h"
> export module VERSION;
What about something like this:
#ifdef VERSION
export module version;
#else
export module final;
#endif
Sounds like it will pose the same issue but banning it feels more
drastic.
Even the use of a macro in the module name could probably have
plausible use-cases. Say if you are trying to make a module
that includes a version in its name:
#define VERSION 2
#define VERSIONED_NAME(n) n ## _v2
And then:
export module VERSIONED_NAME(utility);
#if VERSION >= 2
export void only_available_in_v2 ();
#endif
> This paper makes the following ill-formed by forbidding macro expansion
> in the name of module declarations.
>
> version.h:
> #ifndef VERSION_H
> #define VERSION_H
>
> #define VERSION libv5
>
> #endif
>
> lib.cppm:
> module;
> #include "version.h"
> export module VERSION;
What about something like this:
#ifdef VERSION
export module version;
#else
export module final;
#endif
Sounds like it will pose the same issue but banning it feels more
drastic.
Even the use of a macro in the module name could probably have
plausible use-cases. Say if you are trying to make a module
that includes a version in its name:
#define VERSION 2
#define VERSIONED_NAME(n) n ## _v2
And then:
export module VERSIONED_NAME(utility);
#if VERSION >= 2
export void only_available_in_v2 ();
#endif
Received on 2023-11-03 07:43:51