Code demostrating "Distinguishing C++ Declarations from Expressions" in?The Definitive ANTLR Reference.
?
#include <stdio.h>
typedef int I;
char x = 'a';
void foo() {
I(x);
x = 10;
printf("x = %d in foo\n", x);
}
struct _node {
int m;
};
typedef struct _node * T;
T(*a)(int);
int main(int argc, const char *argv[])
{
printf("cast %d, %d\n", I(x), (I)x);
foo();
printf("x = %d in main\n", x);
struct _node n;
T one = &n;
T *a = &one;
T(*a)->m = 8;
printf("m: %d\n", (*a)->m);
return 0;
}
?