C++ Logo


Advanced search

Subject: [std-proposals] Prevent Assignments from contextually converting to bool
From: connor horman (chorman64_at_[hidden])
Date: 2019-10-23 11:35:18

This is my proposed to solution to one of the worst logic errors in any
number of languages, being:

The proposal is to tweak the wording of contextual conversions to bool,
prohibiting unparenthesised assignments from being eligible for contextual
conversion. Code that intends to do this can simply put parenthesis around
the assignment or use an init-statement, and code that does this without
intention (i.e. intends the comparison) would be elevated from a logic
error (the worst kind honestly) to a compile-time error.

STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups