C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Character classification functions should return bool

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 16 Oct 2022 21:59:53 -0700
On Sunday, 16 October 2022 03:42:33 PDT blacktea hamburger via Std-Proposals
wrote:
> Character classification functions in C return int, but C++ has built-in
> bool type, so they should return bool.
>
> And they are usually used like:
>
> if (std::isdigit(c))
> { ... }
>
> So it basically won't break existing code.

Those functions are inherited from C and come from a C header, even if it has
a C++ name (cctype). You need to propose this to WG14 first.

What possible gain would we have for this change? What is that legacy int
hurting?

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

Received on 2022-10-17 04:59:55