C++ Logo

std-proposals

Advanced search

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

From: connor horman <chorman64_at_[hidden]>
Date: Mon, 11 Sep 2023 21:59:58 -0400
TBH, I'd handle that using `&symbolName` personally.

On Mon, 11 Sept 2023 at 19:35, Frederick Virchanza Gotham via Std-Proposals
<std-proposals_at_[hidden]> wrote:

> On Mon, Sep 11, 2023 at 5:04 AM Jens Maurer <jens.maurer_at_[hidden]> wrote:
> >
> > We generally don't specify warnings in the standard.
> >
> > Do you want to make a conversion from function to bool ill-formed,
> > i.e. an error?
> >
> > If so, I think we need a little bit of analysis why this doesn't
> > break a lot of existing code (if any) that (for better or worse)
> > uses that conversion already.
>
>
> It will only break buggy code, because there's no reason to check if a
> function is true or false.
>
> The Standard doesn't talk about 'weak' symbols but we would have to
> accommodate them, something like:
> "Conversion from function to bool is ill-formed unless by a
> proprietary compiler extension a function could possibly evaluate to
> false".
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2023-09-12 02:00:13