C++ Logo

std-proposals

Advanced search

Re: [std-proposals] mandatory compiler diagnostic for converting function to boolean

From: Thiago Macieira <thiago_at_[hidden]>
Date: Mon, 11 Sep 2023 17:27:17 -0700
On Monday, 11 September 2023 02:44:31 PDT Frederick Virchanza Gotham via Std-
Proposals wrote:
> It will only break buggy code, because there's no reason to check if a
> function is true or false.

#ifdef __linux__
static void load_from_proc_cpuinfo()
{
    ...
}
#else
static void (*load_from_proc_cpuinfo)() = nullptr;
#endif

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-09-12 00:27:20