Open dc-mak opened 4 months ago
If we are considering adding syntax, is it possible to use an attribute or something else that survives preprocessing (or, does cn do preprocessing with comments kept?). We are very close to this working:
#define CONST 1
#define cn_definer(ty, def) static ty cn_##def () /*@ something here @*/ { return def ; }
cn_definer(int,CONST)
% gcc -E -P -CC constant_defines.c
static int cn_CONST () /*@ something here @*/ { return 1 ; }
My motivation here is no duplication of the define name.
This is too verbose
Save some pre-processor engineering, this could at least be simplified to
Or even just this where it derives that name from the C function according to some scheme.
Keyword "define" up for debate.