Article View: comp.sys.mac
Article #22458Re: Help wanted: a LSC question
From: howard
Date: Thu, 03 Dec 1987 18:24
Date: Thu, 03 Dec 1987 18:24
39 lines
1872 bytes
1872 bytes
>In article <870053@hpcilzb.HP.COM> tedj@hpcilzb.HP.COM (Ted Johnson) writes:
>>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"
In article <3424@husc6.harvard.edu> singer@endor.UUCP (THINK Technologies) writes:
> You're getting confused between C and Pascal. In C there's no easy
>way to get at the variants of a record.
Assuming something like:
typedef struct {int x, y;} point;
one way of describing a rectangle which would allow easy access is:
typedef union
{
struct {int top, left, bottom, right;} ints;
struct {point topLeft, bottomRight;} points;
} rectangle;
which would allow references of the form:
tempPoint = aRect.points.topLeft;
tempInt = aRect.ints.top;
Note that this doesn't require the overhead of an extra variable to
keep track of variants. Admittedly, Ted got confused, but that's no
reason to make incorrect accusations about C.
--
Howard A. Landman
{oliveb,hplabs}!intelca!mipos3!cpocd2!howard
howard%cpocd2.intel.com@RELAY.CS.NET
"I'm sorry, Dave, but I can't do that."
Technical Details
Message-ID:
<1005@cpocd2.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!cmcl2!nrl-cmf!ames!oliveb!intelca!mipos3!cpocd2!howardReferences:
<870053@hpcilzb.HP.COM> <3424@husc6.harvard.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!cmcl2!nrl-cmf!ames!oliveb!intelca!mipos3!cpocd2!howard From: howard@cpocd2.UUCP Newsgroups: comp.sys.mac Subject: Re: Help wanted: a LSC question Message-ID: <1005@cpocd2.UUCP> Date: Thu, 3-Dec-87 13:24:10 EST Article-I.D.: cpocd2.1005 Posted: Thu Dec 3 13:24:10 1987 Date-Received: Sun, 6-Dec-87 21:08:04 EST References: <870053@hpcilzb.HP.COM> <3424@husc6.harvard.edu> Reply-To: howard@cpocd2.UUCP (Howard A. Landman) Organization: Intel Corp. ASIC Systems Organization, Chandler AZ Lines: 39