| Eclipse indexing wrongly [message #1022322] |
Thu, 21 March 2013 13:11  |
David W Messages: 8 Registered: March 2013 |
Junior Member |
|
|
Hi
I posted this under different category eariler.
I've found a problem and I think it might be an eclipse bug.
I am on redhat 5 x64 running juno. The following code prints out checkpoint2. However, eclipse grayed out checkpoint1 and checkpoint2 . Appraently, eclipse uses a different ULONG_MAX value as from the gcc compiler. Is this a bug from eclipse?
#include <stdio.h>
#include <limits.h>
int main()
{
printf("%llu\n", (unsigned long long) ULONG_MAX);
/* prints 18446744073709551615 and checkpoint2 */
#if (ULONG_MAX >> 31) == 1 <---- grayed out
printf("checkpoint1\n");
#elif (ULONG_MAX >> 63) == 1 <---- grayed out
printf("checkpoint2\n");
#else
printf("checkpoint3\n");
#endif
return 0;
}
|
|
|
|
|
| Re: Eclipse indexing wrongly [message #1022837 is a reply to message #1022322] |
Fri, 22 March 2013 12:05   |
Klaus Mr Messages: 89 Registered: November 2011 |
Member |
|
|
Hello David,
you probably know that Eclipse and CDT are written in Java?
The biggest integer Data Type in Java is long, which is a 64 Bit SIGNED type. This is the reason, why the Editor grayed out the 'if' wrongly, because CDT internally is using "long".
Try out this example, it's using the biggest number, which CDT (and Java) could save in a primitive Data Type "long". In this example checkpoint2 is not grayed out:
#include <stdio.h>
#include <limits.h>
#define TEST_MAX 0x7fffffffffffffffUL
int main() {
printf("%llu\n", (unsigned long long) TEST_MAX);
#if TEST_MAX == 0xffffffffUL +1
printf("checkpoint1\n");
#elif (TEST_MAX >> 62) == 1
printf("checkpoint2\n");
#else
printf("checkpoint3\n");
#endif
return 0;
}
Could you please check Bugzilla, maybe there is already a Bug-Entry about this problem, but if not please add a new bug.
Bugzilla: https://bugs.eclipse.org/bugs/
Java-Data Types: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
regards,
Klaus
|
|
|
| Re: Eclipse indexing wrongly [message #1022869 is a reply to message #1022837] |
Fri, 22 March 2013 13:20   |
David W Messages: 8 Registered: March 2013 |
Junior Member |
|
|
Hi Klaus
Thanks. I don't see an existing bug so I created one last week, ID 403404.
I used your example and yes the checkpoint2 is NOT grayed out.
My case is not as simple as printing out "checkpoinsts". I actually have some typedef within each if condition. Wrongly grayed out means the typedef declaration within the if statement will NOT be known and so the indexing throughout the whole program fails.
Is there a quick fix that we can do to avoid this situation?
Thanks
David
[Updated on: Fri, 22 March 2013 13:21] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01794 seconds