From: Sandeep D. <sa...@dd...> - 2000-06-25 00:15:10
|
Hi Gregor, There was a problem with the register allocator that caused this problem. Fixed now.... Sandeep -----Original Message----- From: sdc...@li... [mailto:sdc...@li...]On Behalf Of Gregor Konermann Sent: Saturday, June 24, 2000 3:02 PM To: sdc...@li... Subject: [Sdcc-user] code problem Hi all! I have a problem with this code (simple ascii-string to int conversion): int String2Int(unsigned char *s) { int i=0; int j=0; int factor=1; while (!(s[i]==0)) i++; i--; while (i>=0) // <----------------------------------- here´s the problem ! { j=j+(factor*((s[i])-0x30)); factor*=10; i--; // <----------------------------------------------- i is decreased here } return (j); } when i is 0, it will be decreased to 0xff, but the loop will not terminate. It seems as if sdcc does not recognize the signed int, so 0xff is larger than 0 and the loop goes on. Is this a "bug" of sdcc or am I doing something wrong??? Many greetings from germany, Gregor |