blob: d78999422853c429d3d26df689e0147ee3dd5240 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/* Example provided by Hannes Janetzek */
struct Test { int test; };
#define BLA(_type) \
_type *bla = (_type*) malloc(sizeof(_type));
#define BLUB(_type) \
(_type*)malloc(sizeof(_type));
#define FOO(_type) \
_type *foo = BLUB(_type);
#define BAR(_type) \
_type *bar = (*_type)BLUB(_type);
int main(int argc, char *argv[]) {
BLA(Test);
bla->// -1-
; // #1# ( "test" )
FOO(Test);
foo->// -2-
; // #2# ( "test" )
BAR(Test);
bar->// -3-
; // #3# ( "test" )
}
|