Path: utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!wuarchive!cs.utexas.edu!asuvax!mcdphx!udc!willcox From: willcox@urbana.mcd.mot.com (David A Willcox) Newsgroups: comp.sys.mac.programmer Subject: Re: Known Symantec Think C 4.01 bug and work-around Message-ID: <1417@urbana.mcd.mot.com> Date: 25 Oct 90 14:19:58 GMT References: <514@tci.UUCP> Distribution: comp Organization: Motorola Microcomputer Division, Urbana, IL Lines: 19 In article steve@huxley.huxley.bitstream.com (Steve Stein) writes: >In all fairness to Symantec, THIS IS NOT A BUG!!! (This is a "feature" of C.) >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".) In all fairness to C, your statement is false. C functions have been able to return structures for quite some time - I think that every UNIX compiler I've used since Version 6 days has allowed it. You're right, K&R does say that it is illegal, but it is a very common extension to allow it. Also, to quote the ANSI C standard (subclause 3.7.1): The return type of a function shall be void or an object type other than array. In other words, in ANSI C, returning a structure definitely IS legal.