C++ Logo

std-proposals

Advanced search

Re: [std-proposals] return if

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 13 Jan 2026 07:09:48 -0800
On Tuesday, 13 January 2026 07:03:29 Pacific Standard Time Frederick Virchanza
Gotham via Std-Proposals wrote:
> On Tue, Jan 13, 2026 at 2:45 PM Alejandro Colomar wrote:
> > Isn't this exactly the same as the following?
> >
> > if (SomeFunction())
> >
> > return false;
>
> If you're dealing with 'bool' then yes it's exactly the same.

Then:

     if (auto x = SomeFunction) return !x;

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

Received on 2026-01-13 15:09:54