Article View: comp.sys.mac
Article #24129Re: Serious MPW C bug!
From: Joe MacDougald
Date: Wed, 20 Jan 1988 01:19
Date: Wed, 20 Jan 1988 01:19
48 lines
2607 bytes
2607 bytes
In article <674@PT.CS.CMU.EDU> mkb@rover.ri.cmu.edu (Mike Blackwell) writes:
>If you're using MPW 2.0 C, beware of floating point operations. I just spent
>two hours tracking down the following bug (it took that long, because it was
>a complicated program, and I didn't even think to look for such a major
>compiler bug). Try this simple program:
[ source omitted...]
This bug was found and fixed. The version that contains the fix is available
from APDA as MPW C 2.0.2.
>While I'm bitching about MPW, quick and dirty programs which just use stdio
>for output (like this one) crash instantly under Multifinder. And you'd
>think, with the horsepower of a Mac2 on my desk, I could compile, or at
>least print, in the background, but nooo.... Most every other application
>can take advantage of background printing these days. Humph. And I used to
>love MPW.
The C stanard library function printf assumes the defination of stdout as a
buffer for writing output to. If you have linked your program as an '-t APPL'
(ie. application, the default) the MPW Shell will suspend itself and
run your "application" under the (Multi)Finder. Here is your problem.
This buffer is undefined under MultiFinder as well as Finder.
Printf "works" (read: prints to the screen through the "Macintosh Interface")
when Finder is running due to support included in StdCLib.o. This functionality
was added primarily to debug tools under an unstable shell environment.
Printf *can not* work, even with this support, under MultiFinder, due to
the context shifts which move memory around as well as to disk and back.
If you link your program as '-t MPST' (MPW Shell Tool) then it will function
as one would expect, writing output to the Worksheet ( which is predefined as
stdin, stdout and stderr), even if MultiFinder is active!
Thanks for your support and I hope this answers your questions and restores your
faith in MPW.
joe.
| UUCP {decwrl, inhp4, hplabs, sun}!apple!joemac |
| Internet joemac@apple.com |
| |
Since I'm not in Tech Support:
| The standard disclaimer applies: "I do not speak for Apple Computer, Inc." |
Technical Details
Message-ID:
<7223@apple.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!think!ames!amdahl!nsc!voder!apple!joemacReferences:
<674@PT.CS.CMU.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!think!ames!amdahl!nsc!voder!apple!joemac From: joemac@apple.UUCP (Joe MacDougald) Newsgroups: comp.sys.mac Subject: Re: Serious MPW C bug! Message-ID: <7223@apple.UUCP> Date: 20 Jan 88 01:19:58 GMT References: <674@PT.CS.CMU.EDU> Reply-To: joemac@apple.UUCP (Joe MacDougald) Organization: Apple Computer Inc., Cupertino, USA Lines: 48 Keywords: Upgrade!