Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What will this output?

Name: Anonymous 2016-06-19 12:21

What will this program output?
Good luck, you'll need it!

#include <iostream>
using namespace std;

int main() {
class c {
public:
c() {
void f();
f();
}
};

c my_c();
}

void f() {
cout << "VALID C++" << endl;
}


The answer is absolutely nothing because c my_c(); is a fucking function declaration.

Name: Cudder !cXCudderUE 2016-07-10 15:35

>>28
What the hell do you need to "prove" anyway. I claimed C++ parsing wasn't all that hard, and once you understand how it works, it really isn't. If you applied the same reasoning you'd probably claim the Thompson NFA algorithm needs "infinite lookahead" too, and yet AFAIK no one has ever said that.

>>31
as the dereference operator is a unary operator and multiplying a typename by an undeclared identifier doesn't make sense.

It could've been declared in an outer scope. If you want to really cast x to an int, read y and throw its value away (which is perfectly acceptable and the compiler would have to do it if it was declared volatile, and then apply unary operator*() to z, then you would need to do this:

(int(x), y, *z);

Type specifiers cannot start with a parenthesis, so the parser is immediately going to go down the expression path.

>>29,30
U MAD?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List