Skip to main content


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 21:58
David Koes is currently offline David KoesFriend
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:MBS Custom launch configuration type filter
Goto Forum:
  


Current Time: Fri Apr 26 09:14:57 GMT 2024

Powered by FUDForum. Page generated in 0.03037 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top