[En-Nut-Discussion] Bug in putf

Ralph Mason ralph.mason at telogis.com
Mon Apr 7 12:17:56 CEST 2003


Hi,

I noticed a bug in putf

When you print an unsigned value that is greater than the max signed value
for the type putf has a problem.  The code putf sign extends the unsigned
value into a long (because it treats the unsigned value as signed when it
copies to ulval)

thus

buff[32];
sprintf(buff,"%u",0xffff);

Yields a very unexpected result (0xffffffff formatted as an unsigned long).

Ralph


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.461 / Virus Database: 260 - Release Date: 10/03/2003




More information about the En-Nut-Discussion mailing list