Re: warning on assignment within conditional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"John (Eljay) Love-Jensen" <eljay@xxxxxxxxx> writes:

>> We're using iwmmxt_le-g++ (GCC) 3.3.1 (MontaVista 3.3.1-7.0.2.0401382 2004-10-07) ...
>
> Ahh, C++.
>
>> But it doesn't produce a warning on this line
>>        if (bFoundFile = false) {
>> which is the actual code line that prompted my question.
>
> In C++, a bool is a truth value.  If bFoundFile is a bool, then that constitutes a truth value.  So it would not result in a warning.


I actually fixed that not too long ago, and current versions of g++ do
give a warning for this construct.  gcc 3.3.1 is quite old, though.  I
think the warning is new in 4.4, or possibly 4.3.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux