Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!aplcen!samsung!munnari.oz.au!comp.vuw.ac.nz!kaukau.comp.vuw.ac.nz!andrew From: Andrew.Vignaux@comp.vuw.ac.nz (Andrew Vignaux) Newsgroups: comp.lang.perl Subject: Re: Bug in Perl 3.0/6 under SunOS 4.0x on Sun3 Message-ID: <1989Dec31.003420.18182@kaukau.comp.vuw.ac.nz> Date: 31 Dec 89 00:34:20 GMT References: <291@fwi.uva.nl> Sender: news@kaukau.comp.vuw.ac.nz (News Admin) Reply-To: andrew@comp.vuw.ac.nz (Andrew Vignaux) Organization: Comp Sci, Victoria University, Wellington, New Zealand. Lines: 24 In article <291@fwi.uva.nl> casper@fwi.uva.nl (Casper H.S. Dik) writes: >sun3% perl -e 'printf("%x\n", -1);' >0 >doarg.c:549: (void)sprintf(buf,s,(unsigned int)str_gnum(*(sarg++))); The unsigned casts went in after my bug report about printf("%x\n", 0x82c3060c); core dumping on some machines (HP9000/300 & /800) due to the bad double->int conversion. I was never very happy about my suggestion to just put in the casts, because printf("%x\n", 12345678901234567890); can still dump core or give bogus results. You can't do very much about protecting perl from this sort of thing. The best method probably is to examine the format string and perform the appropriate conversion -- which is exactly what happens now (bar any core-dump prevention). Unfortunately, it means that -1 can't be "%x"d. Anyway, core dumping is better than printing some other number (unless Larry wants to put BIGNUMs into perl ;-) Andrew -- Domain address: Andrew.Vignaux@comp.vuw.ac.nz