On 1/29/21 4:12 PM, Will Cooke via cctalk wrote:
On 01/29/2021 2:58 PM Fred Cisin via cctalk
<cctalk at classiccmp.org> wrote:
'=' and '==' makes possible what
is probably the most common error, and
which the compiler doesn't catch:
if (x = 3) . . . /* sets x to 3 and gives TRUE for the condition */
I imagine that there are probably some pre-processors that would return a
WARNING for it.
Modern Visual Studio and GCC both flag the "=" in a condition, I believe. But
if you're shipping code with 260+ warnings, who would see one more.
And the problem here is really quite plain and simple.
Why are you shipping code with any warnings?
There's a pretty good chance the heat pump you're using right now has those
warnings. Alas...
Just because some other programmer is an idiot doesn't mean I have
to be.
bill