tech.lgbt is one of the many independent Mastodon servers you can use to participate in the fediverse.
We welcome all marginalized identities. This Mastodon instance is generally for folks who are LGBTQIA+ and Allies with an interest in tech work, academics, or technology in general.

Server stats:

3K
active users

whoa whoa wait a second

if C23 introduced the concept of "directive parameters"

...we can potentially (no technical obstacle) do _this_:

// myheader.h
MY_K 6
struct MY_T { int x; };
void MY_foo (void);

// main.c
"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

Quiet public

(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 ` $PREFIX$_COUNTER`)

Public

@thephd planned it all along huh :D

Public

@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....

Quiet public

@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

Public

@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...

Quiet public

@hcmh
take a look at 6.10.3 "Binary resource inclusion"

they are currently only defined for `` but @thephd has designed it to be essentially as extensible as `[[attributes]]`, so one can add this with relative ease

Quiet public

@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 :)