Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Correct parsing of for loop macros
Correct parsing of for loop macros [message #998875] Thu, 10 January 2013 16:58
David Koes is currently offline David Koes
Messages: 6
Registered: July 2009
Junior Member
I'm using code that defines loop macros like this:
#define FOR(i,n) for(unsigned i = 0; i < n; i++)

Unfortunately, these constructs do not get properly indented and line wrapped. I can redefine them when __CDT_PARSER__ is set to be
#define FOR(i,n) for(;;)
and then I get the proper indentation and line wrapping, but then i is no longer defined.

Any suggestions on how to get the desired behavior? Should I file a bug? This is version 8.1.1.201209170703.

#include <cstdio>

#define FOR(i,n) for(unsigned i = 0; i < n; i++)

#ifdef __CDT_PARSER__
#undef FOR
#define FOR(i,n) for(;;)
#endif

int main(int argc, char *argv[])
{
	FOR(i, 5)
	{
		printf("%d\n", i);
	}
}
Previous Topic:How to disable PTP in Indigo
Next Topic:mingw: undefined reference to `WinMain@16'
Goto Forum:
  


Current Time: Fri Aug 22 23:42:05 EDT 2014

Powered by FUDForum. Page generated in 0.02343 seconds