Path: utzoo!attcan!uunet!wuarchive!zaphod.mps.ohio-state.edu!usc!nic.csu.net!csus.edu!ucdavis!iris!lim From: lim@iris.ucdavis.edu (Lloyd Lim) Newsgroups: comp.sys.mac.programmer Subject: Re: Known Symantec Think C 4.01 bug and work-around Message-ID: <7865@ucdavis.ucdavis.edu> Date: 24 Oct 90 02:52:39 GMT References: <514@tci.UUCP> Sender: usenet@ucdavis.ucdavis.edu Reply-To: lim@iris.ucdavis.edu (Lloyd Lim) Distribution: comp Organization: U.C. Davis - Department of Electrical Engineering and Computer Science Lines: 21 In article steve@huxley.huxley.bitstream.com (Steve Stein) writes: >C functions may not return structs (ref: Kernighan & Ritchie's "The C >Programming Language", Appendix A ("C Reference Manual") Section 8.4: >"functions may not return arrays, structures, unions or functions".) Your K&R is out of date. This has changed with ANSI C. Here's a quote from K&R, Second Edition, p. 129, "The only legal operations on a structure are copying it or assigning to it as a unit, taking its address with &, and accessing its members. Copy and assignment include passing arguments to functions and returning values from functions as well." To reiterate, in Appendix C, Summary of Changes, p. 260, "Structures may be assigned, passed to functions, and returned by functions." If you look at K&R 2 and the THINK C manual, you'll notice there are quite a few differences between ANSI C and THINK C. +++ Lloyd Lim Internet: lim@iris.ucdavis.edu (128.120.57.20) Compuserve: 72647,660 US Mail: 215 Lysle Leach Hall, U.C. Davis, Davis, CA 95616