Home > Computer science and math, English > C++ hidden feature

C++ hidden feature

This is one I didn’t know. Conditional expressions in C++ can be lvalue:

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

More hidden features: http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/

  1. Pff
    October 21st, 2009 at 12:22 | #1

    Lol? Hidden feature? This is standard in C++ programming…

  1. No trackbacks yet.