Hidden Features of C++? -


no c++ love when comes "hidden features of" line of questions? figured throw out there. of hidden features of c++?

most c++ programmers familiar ternary operator:

x = (y < 0) ? 10 : 20; 

however, don't realize can used lvalue:

(a == 0 ? : b) = 1; 

which shorthand for

if (a == 0)     = 1; else     b = 1; 

use caution :-)


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -