Bill Knight wrote:

The problem is possibly that bswap_32() is a macro
which accesses its parameter (*ptr++) twice.  That would
cause *ptr++ to be incremented twice and to return the
wrong value the second time.

yes, good point.
i mean to remeber seeing such a warning in a case where a #define was involved.

the warning for uninitilized variables is slightly different, so my point isnt valid anyway

-Bill Knight


On Thu, 26 Feb 2004 21:18:39 +0100, Chris Liechti wrote:

Garst R. Reese wrote:

Beware,
mmc.c:39: warning: operation on `ptr' may be undefined
is emmitted with the following code.
int32_t sum, ptr;
sum += bswap_32(*ptr++);


well you never init ptr, thus the warning.
add:
  ptr = 0;
or most likely something other than zero...

and without "sum = 0" at the beginning you'll probably never be happy with the result ;-)

note: local vars are not initialized, unlike globals. you have to explictly assign a value.

chris


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users





-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users




Reply via email to