diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-05-10 10:49:11 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-05-11 16:55:22 +0000 |
commit | 81793b8b58cde01e52675093dc378147dc2102e3 (patch) | |
tree | af7819c28b7718327eb91d6466e9414d512af411 /LICENSE.GPL3 | |
parent | e64b2234e829cc47872225debcf80d6c06db18f0 (diff) |
Add QT_NO_FOREACH to disable foreach and Q_FOREACH
It has been known for a long time that Q_FOREACH produces
inferior code to other looping constructs, and the use of it
in Qt library code was informally frowned upon since forever
(pun intended).
Yet, to this day, several thousand foreach/Q_FOREACH loops
have been added to Qt libraries, and while many were ported
to range-for in Qt 5.7, there are still new ones added every
day, which is a nuisance, to say the least.
This patch introduces a technical way to prevent new foreach
use to creep into Qt libraries after they have been cleaned,
by simply not defining either Q_FOREACH or foreach when the
QT_NO_FOREACH macro is defined. This way, one library at a
time can be ported away, and, once ported, is guaranteed to
actually stay ported.
Change-Id: Ie042e84d6c7d766bd16095f9bc1118a8e0ce0c7a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'LICENSE.GPL3')
0 files changed, 0 insertions, 0 deletions