[Development] 8b7a8efe6 broke the dev branch

André Pönitz andre.poenitz at mathematik.tu-chemnitz.de
Sun Sep 8 22:37:40 CEST 2013


On Sat, Sep 07, 2013 at 08:53:05AM -0700, Thiago Macieira wrote:
> On sábado, 7 de setembro de 2013 17:25:56, Mark wrote:
> > While trying to update my Qt build i got this nasty unexpected error:
> > http://paste.kde.org/p7c51188c/
> > 
> > Or rather, two other folks from #kde-devel had that. While i recompiled i
> > was welcomed by the same error.
> 
> Not a bug in Qt.
> 
> Look at the error message you're getting:
> 
> qjsonvalue.h:70:9: error: expected identifier before ‘int’
>          Bool = 0x1,
>          ^
> 
> Why is it talking about "int" and pointing to "Bool"?
> 
> Answer: you #included <X11/xlib.h> and forgot to clean it up. It has a #define 
> Bool.

While indeed not being a exactly a bug in Qt this breakage was, as others,
predictable and could have been avoided by simply sticking to the rules
laid out in "Designing Qt-Style C++ APIs", section "The Art of Naming",
subsection "Naming Enum Types and Values" which states:

  "When declaring enums, we must keep in mind that in C++ (unlike in
   Java or C#), the enum values are used without the type."

and continues later

  "One guideline for naming enum types is to repeat at least one element
   of the enum type name in each of the enum values"

Calling an enum value "Bool" should have been a no-go, even if in this
case the reason was not 'clash-due-to-similar-enums' but 'clash-
due-to-common-names-for-macros'.

Andre'

PS: The full version is at http://doc.qt.digia.com/qq/qq13-apis.html



More information about the Development mailing list