Article View: comp.sys.atari.st
Article #33577MWC v3.0: Bug and solution
From: Rob Carriere
Date: Sun, 14 Aug 1988 22:44
Date: Sun, 14 Aug 1988 22:44
43 lines
1741 bytes
1741 bytes
The following program breaks the MWC C compiler (v3.0, I don't know
about others):
------- try.c -----
float foo( bar )
float (*bar)();
{
return (*bar)(3.0); /* breaks here */
}
float sqr( sink )
float sink;
{
return sink*sink;
}
main()
{
printf( "%g\n", foo( sqr ));
exit(0);
}
------- end of try.c ---
Compile this with
cc -f try.c
to get an ``internal compiler error'' referring to the line commented
with ``breaks here''. I called MWC tech support, and they told that
they knew of the problem and were working on it, but for the time
being there was a very simple solution: change the declaration for bar
to
double (*bar)();
and it will work.
Making the appropriate changes indeed causes the program to compile
and link without errors; when run, it gives the correct output
(9.00000), and terminates normally.
BTW: tech support from MWC was very good: I was talking to the right
guy in under 30 seconds, and he was polite, helpful, to the point, and
knew what he was doing. They left a good impression there.
Rob Carriere
Technical Details
Message-ID:
<470@accelerator.eng.ohio-state.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!accelerator.eng.ohio-state.edu!baloo.eng.ohio-state.edu!robShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!accelerator.eng.ohio-state.edu!baloo.eng.ohio-state.edu!rob From: rob@baloo.eng.ohio-state.edu (Rob Carriere) Newsgroups: comp.sys.atari.st Subject: MWC v3.0: Bug and solution Summary: pointers to fn's returning float don't work, ditto double do Keywords: bug, solution, pointer-to-fn-returning-float Message-ID: <470@accelerator.eng.ohio-state.edu> Date: 14 Aug 88 22:44:50 GMT Sender: news@accelerator.eng.ohio-state.edu Reply-To: rob@baloo.eng.ohio-state.edu (Rob Carriere) Organization: Ohio State Univ, College of Engineering Lines: 43