The following code prints out a 1:
const int i = 1;
{
enum
{
i = i
};
cout << i << endl;
}
Note that it looks like it could have undefined behavior, but it doesn't.
Reference: "C++ Gotchas" by Stephen Dewhurst Addison-Wesley, 2002., p. 54.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment