In C++ programming, adding a compiler flag or pragma statement assignment within conditional expression as an error
#pragma warning(error:4706)
sorts out all programming mistakes such as this.
if (a = b) ...
On the other hand, Wikipedia says Yoda Conditions also prevents from access violation problem, but it looks like that there is no reproducable case in C++.
Thus, are Yoda Conditions of no need if we turn on that compiler option?
Aucun commentaire:
Enregistrer un commentaire