C++ - Function declarations inside function scopes?
Although I had no idea you can do this, I tested it and it works. I guess you may use it to forward-declare functions defined later, like below:
#include <iostream>
void f()
{
void g(); // forward declaration
g();
}
void g()
{
std::cout << "Hurray!" << std::endl;
}
int main()
{
f();
}
If you remove the forward declaration, the program won't compile. So in this way you can have some kind of scope-based forward declaration visibility.