[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppLogicalAndOperator
Avoid overloading &&.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppLogicalAndOperator
(C++) and, && operator
The logical-and-operator is used in conditional statements. You can write both and and &&.
if (x==0 and y==0)
{
//x and y were equal to zero
//Do something
}
if (x==0 && y==0)
{
//x and y were equal to zero
//Do something
}
Avoid overloading &&.
'Logical AND operator' links
Reference
- Herb Sutter and Andrei Alexandrescu. C++ coding standards: 101 rules, guidelines, and best practices. ISBN: 0-32-111358-6, Item 30: Avoid overloading &&, || or , (comma).
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
