+ Reply to Thread
Results 1 to 4 of 4

Thread: QBool

  1. #1
    Join Date
    Oct 2009
    Location
    Vienna, Austria
    Posts
    57
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QBool

    Could someone explain me why Qt is using the QBool type instead of bool?
    What is the advantage?

  2. #2
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QBool

    They defined some extra auxiliary functions for their QBool. Take a look to qglobal.h.
    I'm a rebel in the S.D.G.

  3. #3
    Join Date
    Oct 2009
    Location
    Vienna, Austria
    Posts
    57
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QBool

    I've already checked it but I cannot see the advantage.

  4. #4
    Join Date
    Apr 2016
    Posts
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QBool

    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.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts