C++26: A Placeholder with No Name

sandordargo.com

95 points by jandeboevrie 5 days ago


carom - 2 days ago

I am so shocked at how many people use `auto` in C++. I can not think of a worse thing to do to your code in terms of readability and future maintainability. Maybe it is OK if you use an IDE to identify types for you but I still hate it. I am trying to learn a new library right now with light documentation which means reading the code, and between typedefs, auto, and technical debt, it is a tedious exercise to figure out something's type, to go look up its function, to see what type that is returning.

SideburnsOfDoom - 2 days ago

See c#:

"A discard communicates intent to the compiler and others that read your code: You intended to ignore it.

You indicate that a variable is a discard by assigning it the underscore (_) as its name."

https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals...

2020: http://dontcodetired.com/blog/post/Variables-We-Dont-Need-No...

agumonkey - 2 days ago

Makes me wonder when '_' was first used as a token to denote unused information. Prolog ? ML ?

kookamamie - 2 days ago

What a convoluted mess.

wild_pointer - 2 days ago

"In addition, there are some variables such as locks and scope_guards that are only used for their side effects"

...

"This solution is also similar to other languages’ features or conventions"

As far as I know, in Rust you can't use "_" for that, as the value will be dropped right away, so the mutex/resource/etc. won't live for the scope.

emcell - 2 days ago

every time i see stuff like this, I hope I never have to work on c++ projects again.

Kenji - 2 days ago

[dead]

ulbu - 2 days ago

https://www.london-fire.gov.uk/media/2045/london-frie-brigad... C++

wiseowise - 2 days ago

Not every "problem" needs a solution.

At this point only LLMs will be able to decipher every intricacy of C++.