$ cat t.c
--------------------------------------------
#define f(x) _##x
int main() {
int f(x) = 3;
return _x;
}
$ make t
cc t.c -o t
$ ./t
$ echo $?
3
--------------------------------------------
I wonder how to do this in D? using template / mixin? traits?
Can you show me an example?
Thanks.
I want to generate a new symbol (new variable name) from existing
one: e.g. in C:
- how to achieve C's Token Pasting (#... mw via Digitalmars-d-learn
- Re: how to achieve C's Token P... Paul Backus via Digitalmars-d-learn
- Re: how to achieve C's Tok... mw via Digitalmars-d-learn
- Re: how to achieve C's... Johannes Loher via Digitalmars-d-learn
- Re: how to achieve C's... Paul Backus via Digitalmars-d-learn
- Re: how to achieve... mw via Digitalmars-d-learn
- Re: how to ac... Ali Çehreli via Digitalmars-d-learn
- Re: how t... Ali Çehreli via Digitalmars-d-learn
- Re: how to ac... mw via Digitalmars-d-learn
