KDE/kdevelop

David Nolden zwabel at googlemail.com
Tue Jan 8 13:26:33 UTC 2008


On Tuesday 08 January 2008 13:48:27 Kris Wong wrote:
> > has foreach been added as part of the new C++ standard? I was under
> > the impression it was only a Qt extension.
>
> This is a Qt macro.  The parser shouldn't need to know how to parse it, as
> it's defined in qglobal.h.
>
> Along those lines, adding the following to the "special headers" in the C++
> Parsing section of the KDevelop configuration did not seem to work:
>
> #define foreach(x, y) x;
>
> then, using:
>
> foreach (MyClass myclass, myclasslist)
> {
>    myclass.  // <-- code completion does not work
> }
>
> Does not function properly.  The "myclass" variable is unresolved.
>
> Kris Wong

With the solution now in kdevelop4, the use-highlighting and refactoring will 
also work for MyClass, myclass, and myclasslist in your example. With a macro 
solution, that wouldn't work that nicely. At least I think we cannot follow 
back macros currently while building uses.

If there is a macro defined in qglobal.h, then it currently isn't picked up by 
the preprocessor in kdev4, at least I haven't noticed it. That'll need some 
investigation.

greetings, David




More information about the KDevelop-devel mailing list