Quick Q: Is (4 > y > 1) a valid statement in C++? How do you evaluate it if so?

Quick A: This is not a valid statement.

Recently on SO:

Is (4 > y > 1) a valid statement in C++? How do you evaluate it if so?

The statement (4 > y > 1) is parsed as this:

((4 > y) > 1)

The comparison operators < and > evaluate left-to-right.

The 4 > y returns either 0 or 1 depending on if it's true or not.

Then the result is compared to 1.

In this case, since 0 or 1 is never more than 1, the whole statement will always return false.

Modern C++: C++11 / C++14 / C++17, February 12th, Berlin -- Don Tait

Seats are still available for KDAB's 3-day training, February 12th, Berlin:

Modern C++: C++11 / C++14 / C++17

by Don Tait

About the training:

Learn the relevant library and language changes

In this hands-on C++11, C++14 and C++17 training for C++ developers, you'll learn about the language changes and the standard library changes introduced in C++11, C++14 as well as changes from C++17.

During the class, the new standards will be demonstrated aided by many examples and you'll get the opportunity to use them right away in our lab projects. 

Course contents:

Important language changes, including:

  • C++11/14: lambdas, range based for loops, strongly typed enums,
  • C++11/14: constexpr, uniform initialization, move semantics, …
  • C++17: improved lambdas, structured bindings, constexpr if, …
  • C++11/14: Functional programming, including lambda, bind and function objects
  • C++11/14: Template meta programming, including variadic templates and perfect forwarding
  • C++11/14: Multithreading (including the C++11 memory model, std::thread, std::async, …)
  • C++17: Templates: Fold Expressions, Class template deduction, …

Find out more and register

Inclusiveness, accessibility, and CppCon 2017 videos--Herb Sutter

Cppcon continues to improve!

Inclusiveness, accessibility, and CppCon 2017 videos

by Herb Sutter

From the article:

CppCon has always aimed to be a welcoming environment for everyone, across the whole diverse worldwide C++ community. We made that a cornerstone of our very first blog post nearly four years ago, and since then we’ve invited speakers from as many industries and personal backgrounds as we could, tried to keep ticket prices affordable (nominal and free for students and volunteers, respectively, to help them attend), rolled out successively more detailed codes of conduct, and at last fall’s event we were excited for the first time to have sessions and events especially geared toward families and kids who are just learning how much fun programming can be… yes, in C++...