Eclipse indexing wrongly [message #1022322] |
Thu, 21 March 2013 13:11  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06713 seconds