Article View: comp.sys.mac
Article #22476Re: Help wanted: a LSC question
From: dorner
Date: Wed, 02 Dec 1987 15:39
Date: Wed, 02 Dec 1987 15:39
41 lines
1858 bytes
1858 bytes
>>Can someone tell me what I'm doing wrong here? Using Lightspeed C v.2.11,
>>I tried to do the following:
>>
>> tempPoint = aRect.topLeft;
>>
>>When I tried to compile this, I got the error message:
>> "Wrong number of arguments to macro topLeft"
>
> You're getting confused between C and Pascal. In C there's no easy
>way to get at the variants of a record. Therefore, there's a macro (declared in
>"QuickDraw.h") for "topLeft" and "botRight". Instead of "aRect.topLeft", say
>"topLeft(aRect)", and all will be well.
>
> --Rich
Ahem.
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.
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.
----
Steve Dorner, U of Illinois Computing Services Office
Internet: dorner@uxc.cso.uiuc.edu UUCP: ihnp4!uiucuxc!dorner
IfUMust: (217) 333-3339
Technical Details
Message-ID:
<174400081@uxc.cso.uiuc.edu>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!rutgers!iuvax!pur-ee!uiucdcs!uxc.cso.uiuc.edu!dornerReferences:
<870053@hpcilzb.HP.COM>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!rutgers!iuvax!pur-ee!uiucdcs!uxc.cso.uiuc.edu!dorner From: dorner@uxc.cso.uiuc.edu Newsgroups: comp.sys.mac Subject: Re: Help wanted: a LSC question Message-ID: <174400081@uxc.cso.uiuc.edu> Date: Wed, 2-Dec-87 10:39:00 EST Article-I.D.: uxc.174400081 Posted: Wed Dec 2 10:39:00 1987 Date-Received: Mon, 7-Dec-87 01:29:43 EST References: <870053@hpcilzb.HP.COM> Lines: 41 Nf-ID: #R:hpcilzb.HP.COM:870053:uxc.cso.uiuc.edu:174400081:000:1211 Nf-From: uxc.cso.uiuc.edu!dorner Dec 2 09:39:00 1987