AFAIK {}
defines a new area, so what does it define?
({});
The compiler compiles this program well:
#include <iostream>
#include <string>
int main()
{
std::string name;
std::cout << "What is your name? ";
{
({});
}
getline (std::cin, name);
std::cout << "Hello, " << name << "!\n";
}
When I replace ({});
with ();
, the compiler cannot compile the program.
Why ({});
is it working well but ();
not working?
I tested the program on cpp.sh. It compiles fine.
source
share