[Qt-creator] Minimizing compile-time conditionals in Qt Creator
André Pönitz
andre.poenitz at mathematik.tu-chemnitz.de
Tue Aug 28 15:22:01 CEST 2012
On Tue, Aug 28, 2012 at 02:50:03PM +0200, Christian Kandeler wrote:
> On 28/08/12 14:19, ext Stephen Chu wrote:
> > On 8/28/12 3:56 AM, Christian Kandeler wrote:
> >> QStringList rc(QLatin1String(".svn"));
> >> if (Utils::HostOsInfo::isWindowsHost())
> >> rc.push_back(QLatin1String("_svn"));
> >> return rc;
> >
> > Doesn't this generate dead code that will never be executed on platforms
> > other than the intended one?
>
> Yes (with C++03 at least).
If the isWindowsHost() implementation is in the header there's
a decent chance the optimizer catches it.
Andre'
PS:
> And if you can provide an example where it demonstrably matters, we
> can switch back to ifdefs for that particular piece of code.
/me mumbles something about "strings"
More information about the Qt-creator
mailing list