Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!boulder!jdm From: jdm@boulder.Colorado.EDU (James D. Meiss) Newsgroups: comp.sys.mac Subject: Possible new bug in Think C 4.0 sprintf Summary: crashes when passed unitialized doubles Keywords: Think C, sprintf Message-ID: <13068@boulder.Colorado.EDU> Date: 23 Oct 89 15:36:54 GMT Sender: news@boulder.Colorado.EDU Reply-To: jdm@boulder.Colorado.EDU (James D. Meiss) Distribution: na Organization: University of Colorado, Boulder Lines: 30 After much hair pulling, I localized a problem in a program that worked fine under Think C 3, but was giving difficulties in the new version, using the ANSI library. The problem seems to be the following: Call sprintf with an unitialized double: main() { double z; char aStr[80]; /* z = 0.0 <==== include this to prevent crash*/ .... sprintf(aStr, ".13lf",z); .... } Now you may think this is a stupid thing to do, I'll probably agree to that, but I don't think it should cause an odd address error. BTW it doesn't crash in sprintf, but memory seems to be trashed, and it crashes soon afterwards. Has someone else seen this? Is there a fix, other than initializing the variable? Jim Meiss jdm@euclid.Colorado.edu