PDA

View Full Version : QBool



doberkofler
31st August 2010, 11:09
Could someone explain me why Qt is using the QBool type instead of bool?
What is the advantage?

lyuts
31st August 2010, 12:24
They defined some extra auxiliary functions for their QBool. Take a look to qglobal.h.

doberkofler
31st August 2010, 14:45
I've already checked it but I cannot see the advantage.

stemd
23rd April 2016, 14:57
6 years later:

http://doc.qt.io/qt-5/sourcebreaks.html


QBool is removed. In Qt 4, QString::contains(), QByteArray::contains(), and QList::contains() returned an internal QBool type so that the Qt3 code if (a.contains() == 2) would not compile anymore. If your code uses QBool, replace it with bool.

Now when there is not only ISO C99, but also ISO C11, and as GCC 4.9 more or less completely implements ISO C11 from 2014, there is no more reason to have QBool around.
Having in mind that ISO C99 defines _Bool, and stdbool.h header defines bool as alias and true and false macros.

https://en.wikipedia.org/wiki/C_data_types#stdbool.h

It seems that programming languages which do not dissapear have latency. That is behavior similar to networks, but this latency (delay) is a few ranges of order bigger.
Network latency is measured in ms, programming languages latency is measured in decades.

Check C, PHP, Python, Java.
C - new standard every ~10 years (1990, 1999, 2011).
PHP - difference between PHP3 and PHP 5 is almost as big as PHP5 - PHP7 difference.
Python 2 and Python 3.
Compare Java 1.0 with 1.4, and 1.4 and Java 8.

You could almost say that ONLY programming language which did not change drastically is Perl, which is very polished in current 5.22 version, but that is not Perl6, for example.