News for hackers. Stuff that matters.
Re:C++: zero-cost static initialization by viralsink on Saturday July 19, 2025 @03:48AM (#44613437)
Lambdas are not fully equivalent since return statements in statement expressions will return at the function level, whereas return statements in lambdas will only return at the lambda level.
Re:C++: zero-cost static initialization by quibono on Saturday July 19, 2025 @06:06AM (#44614110)
Just for clarity, since I didn't understand on first reading.

    int foo() {
    int result = ({ 
        if (some_condition) 
            return -1;  // This returns from foo(), not just the statement expression
        42; 
    });
    // This line might never be reached
}