[Qt-creator] Minimizing compile-time conditionals in Qt Creator

André Pönitz andre.poenitz at mathematik.tu-chemnitz.de
Tue Aug 28 14:05:33 CEST 2012


On Tue, Aug 28, 2012 at 08:36:42AM +0000, andre.poenitz at nokia.com wrote:
> Konstantin Tokarev [annulen at yandex.ru:
> > I think this issues is a fault of Qt Creator. While I understand
> > that it may be impossible to parse disabled block completely in some
> > cases (not in this one btw),
> 
> Where do you draw the line (or rather, how should the parser find out
> where to draw the line)?
> 
> #ifdef Q_OS_WIN struct Foo { int foo; } #else struct Foo { int bar; }
> #endif
> 
> Foo f; f.<Ctrl-Space> ?
> 
> A "flat" store is certainly not an option. When keeping track of
> branches, each #if has the potential to duplicate the size of data
> that needs to be stored in the code model. While it will not be _that_
> bad in practice, this will be prohibitive nevertheless. So what do you
> suggest?

In any case, part of the argument was that with the change we
get proper checks of the whole source, done by real compiler.

Whether the code model should follow the compiler (as it traditionally
does) or accumulated "everything" is secondary, as in the case without
#ifdef both approaches yield the same result. 

Andre'

PS: I wouldn't mind having that in the 2.6 branch. Eike?



More information about the Qt-creator mailing list