[Qt-interest] Regarding the macros in QT

Ian Thomson Ian.Thomson at iongeo.com
Mon Jul 13 17:38:17 CEST 2009


Hi,

The common macros you will find in Qt are the Q_OBJECT and other 
introspection macros. These are useful because C++ lacks introspection.

There's also some additional functional macros such as foreach, which 
acts very similar to BOOST_FOREACH. I consider these macros to be 
reasonably friendly.

I wouldn't label any code bad only because it uses or does not use any 
particular part of a language. It's true that macros are very often 
evil, but they can occasionally solve problems in a much cleaner way 
than any other method. I think Qt's use of macros is pretty sensible and 
clean.

Cheers,
Ian.



Patric wrote:
> Hello all,
> I have some interesting question that I want to ask regarding macros.
> There are a lot of macros defined around QT, but as far as I know in C++ 
> the use of macros is hightly uncommendable.
> Here is a quotation from "The C++ programming language" from it's 
> creator : "Almost every macro demonstrates a flaw in the programming 
> language, in the program, or in the  programmer." .  
>  
> What do you think ? I'm just curious abot that.
>  
> Regards,
> Patric
>  
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list