News for hackers. Stuff that matters.
Re:On the evolution of programming style: How far C++ has mo... by hythloday on Monday March 26, 2012 @03:41PM (#3758304)
Is

  return /* ... */ throw invalid_argument(""); 
really valid C++11?
Re:On the evolution of programming style: How far C++ has mo... by alexk7 on Monday March 26, 2012 @04:38PM (#3758530)
"The rules for conditional operator are quite sophisticated and one of them says that if one of the sub-expressions is a throw expression, the type of the entire conditional operator is that of the other sub-expression." [1]

[1] http://akrzemi1.wordpress.com/2011/05/06/compile-time-comput...

Re:On the evolution of programming style: How far C++ has mo... by hythloday on Monday March 26, 2012 @07:59PM (#3759245)
Thanks for both your and pdw's explanations...the lovely thing about C++ is that there's always something new to learn. ;)
Re:On the evolution of programming style: How far C++ has mo... by pdw on Monday March 26, 2012 @05:11PM (#3758666)
It's valid in all versions of C++, I believe. It's usually motivated with a chained ternary operator:

  return a == ALPHA ? x :
         a == BETA ? y :
         a == GAMMA ? z :
         throw ...;
Although that's not a style I'd recommend.