Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Home » Tip Bank » C++
Language: C++
Expertise: All
Sep 25, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Boolean Literals

The keywords false and true are Boolean literals that evaluate to 0 and 1 respectively. Note that in other programming language, VB for instance, false equals -1 and true equals 1. C++ programmers who write code that interfaces with other environments and languages such as Access are surprised to discover that all the bool values retrieved from a database evaluate to true. The problem is that any non-zero value, including negative values, evaluates as true in C++. Therefore, don't assume that true and false have the same representation in all languages and environments.
Danny Kalev
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date