C++ Logo

std-proposals

Advanced search

Re: [std-proposals] return if

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 13 Jan 2026 15:28:46 -0800
On Tuesday, 13 January 2026 14:41:04 Pacific Standard Time Frederick Virchanza
Gotham via Std-Proposals wrote:
> return ! if SomeFunction();
>
> which would become:
>
> if ( decltype(auto) x = SomeFunction() ) return !x;

What's the motivation for this syntactic sugar? It's saving four words
(decltype, auto, and the variable name twice).

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-01-13 23:28:50