C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Proposal: -Wverbose-style

From: SD SH <Z5515zwy_at_[hidden]>
Date: Fri, 17 Oct 2025 09:28:36 +0000
It's compiler's work. Standard won't require code style.
You can use clang-format and apply it in your develop environment, and not have a proposal there.

获取Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf of Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]>
Sent: Thursday, October 16, 2025 7:54:41 PM
To: std-proposals_at_[hidden] <std-proposals_at_[hidden]>
Cc: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Subject: Re: [std-proposals] Proposal: -Wverbose-style

On Tue, Oct 14, 2025 at 6:21 PM Jerome Saint-Martin wrote:
>
> Just write `if (flag)`
> if (flag == true)


I think your post here is interesting though along the lines of being
able to specify an option/switch/flag to the compiler, because
currently the Standard doesn't allow for it, so perhaps consider
writing a proposal about having the compiler accept
options/switches/flags.

Just by the way, when I'm checking for 'true', I do:

    if ( flag )

And when I'm checking for 'false', I do:

    if ( false == flag )

because I like the verbosity. It's less easy to miss a "false ==" than a "!".

By the way, be careful with comparing things to 'true' because integer
promotion might screw you (as 'true' becomes 1), for example:

    int CheckFlag(void) { return 7; }

    int main(void) { return true == CheckFlag(); }
--
Std-Proposals mailing list
Std-Proposals_at_lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-10-17 09:28:42