This is a follow up to this question right here.
typedef int foo;
#define bar int
int main() {
bool foo = true; // ok
bool bar = true; // fail
}
the typedef
works, but I am curious to know how can the typedef here work?
How does the final compiled code looks like with respect to foo
? According to few answers, typedef
is an alias and alias is allowed to be shadowed. Hence the code works.
Can anyone please explain?