C++ Logo

std-proposals

Advanced search

Re: [std-proposals] comparison between pointers and bool

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Mon, 20 Apr 2026 15:04:48 +0200
Il 20/04/26 14:52, sasho648 via Std-Proposals ha scritto:
> And the topic is - should converson from pointer to bool like this be
> allowed.

What do you mean, should it be allowed? It *is* allowed and it's
well-formed code. Do you mean, should it be disallowed?

I have to be honest her, as much as it is a good idea, in a language
without epochs, that's never going to happen. Your best shot is to ask
compiler vendors to implement this as a warning and turn it on. Clang
already has it (for string literals to bool), and clang-tidy has one for
pointers to bool.

HTH,
--
Giuseppe D'Angelo

Received on 2026-04-20 13:04:52