r/cpp • • May 09 '26

Any good tech talks leveraging statement expressions?

Lambdas do a great job in a lot of cases but sometimes you need a statement expression. Any good content on youtube?

16 Upvotes

33 comments sorted by

View all comments

Show parent comment

3

u/aruisdante May 09 '26 edited May 09 '26

Agree completely, and generally the visual noise makes it harder to track what is done where, which makes bugs more probable and it makes people dislike using monadics or similar control-flow hiding style despite it being more robust. Alas, AutoSAR and MISRA are extremely prescriptive, and both have a required rule to explicitly capture all variables. Obviously the shop using statement exprs wasn’t strictly following either since they both ban non-standard compiler extensions, but their style guide was following as close as possible in case they did wind up having to do so (it was a self driving company).