Results 1 to 3 of 3
hi,
please look at the code at line no 10.when i compare the 'k' value with 4294967290 (in hex FFFFFFFF) iam getting warning.
ETEL_ACCLERATION(float accel)
{
1> char cmd[17];
2> ...
- 05-11-2007 #1Just Joined!
- Join Date
- Nov 2006
- Location
- Hyderabad
- Posts
- 85
pbm in comparision with 4294967290
hi,
please look at the code at line no 10.when i compare the 'k' value with 4294967290 (in hex FFFFFFFF) iam getting warning.
ETEL_ACCLERATION(float accel)
{
1> char cmd[17];
2> unsigned long x;
3> unsigned long k;
4> int f;
5>
6>
7> x=(accel/360)*61084;
8> k=accel*169.6778;
9>
10> if((k>=16777216) && (k<=4294967290))
11> {
12> f=k/16777216;
13> cmd[11]=f;
14> k=k-(f*16777216);
15> }
16> if((k>=65536) && (k<=16777215))
17> {
18> f=k/65536;
19> cmd[10]=f;
20> k=k-(f*65536);
21> }
22> if((k>=256) && (k<=65535))
23> {
24> f=k/256;
25> cmd[8]=f;
26> k=k-(f*256);
27> cmd[9]=k
28> }
}
when i compile this code iam getting warning at line no 10.
warning: this decimal constant is unsigned only in ISO C90
I am using RHEL 2.6
could anybody please tell me how to overcome this warning.
thank you in advance for any reply.
bye
- 05-11-2007 #2
It's just a warning. You should be fine. But here's another warning: whoever has to read that code might get pisst at you lol. Reading that hurts my head. You should be indenting so code blocks match up like
orCode:if (k == 0) { printf("Something\n"); }
Code:if (k == 0) { printf("Something\n"); }
- 05-11-2007 #3Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Define the variables x and k as unsigned long long and use the suffix "LLU" at line 10 for the large numbers:
Code:unsigned long long x; unsigned long long k; . . if((k>=16777216LLU) && (k<=4294967290LLU)) { . . } . .
Regards


Reply With Quote