From: <no...@so...> - 2001-09-09 13:46:23
|
Bugs item #460002, was opened at 2001-09-09 06:46 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=100599&aid=460002&group_id=599 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Marc Nijweide (nijweide) Assigned to: Nobody/Anonymous (nobody) Summary: Loop turns negative when it shouldn't Initial Comment: void main( void ) { unsigned char *adr; unsigned char buf[ 16 ]; unsigned char i; adr=0xA000; for ( i = 0; i < 16; i++ ) { buf[i]=*adr; ++adr; } } Actually is compiled as if the for loop reads: for (i=16; i>0; --i) Which copies values from adr to buf the wrong way around. Rewriting buf[i] to *(buf+i) solves it. I'm using the MingW september 8 snapshot. Compiler flags: -mz80 -c ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=100599&aid=460002&group_id=599 |