News Score: Score the News, Sort the News, Rewrite the Headlines

C++26: a placeholder with no name

Let’s continue exploring C++26. In this post, we are going to discuss a core language feature proposed by Corentin Jabot and Micheal Park in P2169R4. With the new standard we get a cool unnamed placeholder.MotivationsBy convention, when we have a variable whose value we don’t want to use or care about, we often name it _. The problem is that with higher warning levels (-Wunused-variable), our compilation might fail because _ is unused.1 2 3 4 5 6 7 8 int foo() { return 42; } auto _ = foo(); /* e...

Read more at sandordargo.com

© News Score  score the news, sort the news, rewrite the headlines