whoa whoa wait a second
if C23 introduced the concept of "directive parameters"
...we can potentially (no technical obstacle) do _this_:
// myheader.h
#define MY_K 6
struct MY_T { int x; };
void MY_foo (void);
// main.c
#include "myheader,h" rename_prefix(MY_, Rename_)
int x = Rename_K;
typedef struct Rename_T S;
void foo (void) { Rename_foo (); }
for me the USP would be the ability to sub into *macro* names, but i suppose it would be cleaner if it hit every identifier in a file without considering context
(the reason for wanting to sub into macro names is so that you don't need a fixed number of files like `BOOST_PP_SLOT_1`, `BOOST_PP_SLOT_2`, etc., all generated from a template header by an external script - the script that would renumber the headers and change the prefixes would become part of the directive and you would just ship the template header with its names like `#define $PREFIX$_COUNTER`)
@thephd planned it all along huh :D
@erisceleste A long time ago Joe Groff from Apple asked me about whether or not there could be some way to inject names into a header file, specifically, that could be used to include things. At the time, I said that was above my paygrade. It still is, and as a member of the C Committee my job is to standardize existing practice.
But that doesn't mean someone who's not part of the C Committee and lies squarely as an implementer can't put 2 and 2 together to make a beautiful 4....
@thephd
given that my implementation needs to do a lot of stuff involving stub headers and forwarding, this is even something i can legitimately go first on - rare case of a feature that is genuinely useful to our business case without needing to be following exactly what Clang/GCC/fuckin' Cosmic etc. do
@erisceleste Do you have a link to a description of "directive parameters"? Somehow I cannot find anything in the list of changes in C23 that I found...
@erisceleste Ahhh, now it makes sense, now I understand what you mean by directive parameters, thank you very much! I thought there was a another C23 change by @thephd that I had missed so far :)