Mail Archives: djgpp/1997/07/03/07:05:01
csantill wrote:
>
> from: csantill AT lausd DOT k12 DOT ca DOT us
>
> I'm having a problem w/a stupid for loop(or maybe I have newbie luck & I
> just found a bug in GCC v2.72). Ok, I know chars are byte values, but
> they seemed to be signed in DJGPP (ANSI C dictates that they are
> unsigned; but then again, DJGPP isn't ANSI C or ANSI anything else for
> that matter). When I change the RHIDE flag option so that GCC compiles
> chars as unsigned bytes I lose a *warning* about something like "data
> type limitation". But, w/the unsigned char flag on, I get an infinite
> loop(this pisses me off because I call this function from another
> function). If anybody has a work around (while loop, a mix of C wrapped
> in an inline ASM loop) or any other help would be great;
>
> Here's a vague description of my code:
>
> void stupid_error(char get_some_stupid_vars)
> {
>
> char c;
>
> for(c=0;c<=255;c++)
> {
> /* do some stupid newbie stuff */
> }
>
> }
Char c can never become bigger then 255 (because it's a byte) so c will
always be <= 255. You should use an int instead of a char.
- Raw text -