Article View: comp.sys.mac
Article #22449Re: Help wanted: a LSC question
From: steele
Date: Fri, 04 Dec 1987 00:23
Date: Fri, 04 Dec 1987 00:23
42 lines
2044 bytes
2044 bytes
dorner@uxc.cso.uiuc.edu writes:
>[....]
>typedef struct
> {
> union {
> int coords[4];
> Point funnies[2];
> } r_un;
> } Rect ;
>#define top r_un.coords[0]
>#define left r_un.coords[1]
>#define bottom r_un.coords[2]
>#define right r_un.coords[3]
>#define topLeft r_un.funnies[0]
>#define botRight r_un.funnies[1]
>
>This would have worked fine, and allowed me to say r.topLeft.
It would also have caused my code that says
int top, left, bottom, right;
to break in bizarre ways that would have been even more difficult to find
than the r.topLeft problem was (for me, at least). Granted,
Point topLeft;
breaks anyway, but if I'm a representative coder then that rarely
comes up.
>Perhaps (I'm not well versed (yet) in the ins and outs of Macintosh
>programming) there are reasons that this was not done. But to chalk it
>up to a deficiency in C is not correct.
It's not a deficiency in C, but it is a situation where C's syntax is
different from Pascal. Since the definitions are specified in Pascal,
then C programming on the Mac is arguably less well documented than is
Pascal programming, and this is a deficiency of the C environment.
------------------------------------------------------------------------------
Oliver Steele ...!{decvax,ihnp4}!mcnc!unc!steele
steele%unc@mcnc.org
"Life isn't fair. It's just fairer than death, that's all."
-- William Goldman
_The Princess Bride_
Technical Details
Message-ID:
<2286@unc.cs.unc.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!mcnc!unc!steeleReferences:
<870053@hpcilzb.HP.COM> <174400081@uxc.cso.uiuc.edu>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!mcnc!unc!steele From: steele@unc.UUCP Newsgroups: comp.sys.mac Subject: Re: Help wanted: a LSC question Message-ID: <2286@unc.cs.unc.edu> Date: Thu, 3-Dec-87 19:23:36 EST Article-I.D.: unc.2286 Posted: Thu Dec 3 19:23:36 1987 Date-Received: Sun, 6-Dec-87 19:33:34 EST References: <870053@hpcilzb.HP.COM> <174400081@uxc.cso.uiuc.edu> Reply-To: steele@unc.UUCP (Oliver Steele) Organization: University of North Carolina, Chapel Hill Lines: 42