[Qt-interest] Regarding the macros in QT

Justin Noel justin at ics.com
Mon Jul 13 17:58:21 CEST 2009


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.
>

Much like a hammer, macros are a powerful tools that can very very
easily be misused. There are many instances where other C++ tools just
work better. Classic examples are constants and inline functions.
However, macros used in the right place can make software much more
readable and easier to write. For instance Q_OBJECT, Q_PROPERTY and
emit.  Without those macros writing software with Qt would not nearly be
as easy to work with and the results would not nearly be as readable. 

http://www.idinews.com/macroPhobe.html

Also, Bajrne Stroustrup (the creator of C++ you mention) praised Qt's
design and ease of use during the keynote lecture he gave a couple years
ago at Qt Developer Days San Jose. :)

Good luck,
--Justin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: justin.vcf
Type: text/x-vcard
Size: 233 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090713/a8ca4cc9/attachment.vcf 


More information about the Qt-interest-old mailing list