I am working in C++ (not C++/CLI) in Visual Studio 2012.
I don't understand why this code works, I would have expected it to fail at compilation time, but it doesn't even fail at runtime:
double MyClass::MyMethod() const
{
//some code here
return (10, 20, 30, 40);
}
I produced this code by mistake, wasn't on purpose, I noticed the mistake when I was running my Unit Tests. And I am surprised it works. When I run it, it returns 40, the last number on the list.
Can someone explain me what this syntax means and why it works?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…