From: _ Newsgroups: comp.os.msdos.djgpp Subject: Re: Newbie for loop/data type problem Date: Sat, 28 Jun 1997 19:11:32 +0200 Organization: Lyrical kung-fu Message-ID: <33B545C4.1503@geocities.com> References: <33B4CBA2 DOT 40D6 AT lausd DOT k12 DOT ca DOT us> Reply-To: jaarts AT geocities DOT com NNTP-Posting-Host: 145.220.196.37 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 31 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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.