Qt Creator, #define and syntax highlighting
I'd like to show you a strange visual effect that I have in Qt Creator.
To simplify the process of declaring methods exported in a DLL, I've coded some #defines, like the following ones:
#define APIEXPORT __declspec(dllexport)
#define APICALLMETHOD __stdcall
#define DECLARE_FUNC0(fName) int APIEXPORT APICALLMETHOD fName(void)
#define DECLARE_FUNC1(fName, param1) int APIEXPORT APICALLMETHOD fName(param1)
#define DECLARE_FUNC2(fName, param1, param2) int APIEXPORT APICALLMETHOD fName(param1, param2)
so, I use them in my code:
Only for DECLARE_FUNC0, syntax highlighting in the body goes away. Or better, keywords like "new", "if", etc. are highlighted properly, but custom types (i.e. boost::mutex) or class members are not highlighted.
DECLARE_FUNC1, 2, ... work fine.
Does anybody has a scientific, or even magical, explanation??? :)
Which version of Qt Creator are you using?
There was quite a bit of work on the C preprocessor recently, to make it handle defines better, so maybe the issue is already fixed in master:-) Unfortunately this change also introduced some regressions which are currently getting ironed out.
I'm using the latest one, 2.5.0 RC. Anyway, even with latest stable one (2.4.1, if I'm not wrong) it doesn't work.
I was referring to new code in the master branch. Both 2.4.1 and 2.5 were branched of from master before this change landed, so the code is in neither of those.
It would be great if you could take a look at the master branch and tell me if it works there, but unfortunately nightly builds are still not there AFAIK, so that would require a bit of compiling:-( Sorry for the inconvenience, somebody is working on that.
Of course you can also wait for 2.6beta in a couple of month.