Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!princeton!udel!rochester!cornell!batcomputer!pyramid!prls!gardner From: gardner@prls.UUCP Newsgroups: comp.sys.mac Subject: Re: Help wanted: a LSC question Message-ID: <7835@prls.UUCP> Date: Fri, 4-Dec-87 13:15:49 EST Article-I.D.: prls.7835 Posted: Fri Dec 4 13:15:49 1987 Date-Received: Tue, 8-Dec-87 03:28:44 EST References: <870053@hpcilzb.HP.COM> <3424@husc6.harvard.edu> <1005@cpocd2.UUCP> Reply-To: gardner@prls.UUCP (Robert Gardner) Organization: Philips Research Labs, Sunnyvale, California Lines: 30 In article <1005@cpocd2.UUCP> howard@cpocd2.UUCP (Howard A. Landman) writes: >>In article <870053@hpcilzb.HP.COM> tedj@hpcilzb.HP.COM (Ted Johnson) writes: >>>I tried to do the following: >>> tempPoint = aRect.topLeft; >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; Megamax did this. It's a pain. I was very relieved to see LSC's method of defining Rect's. It's much more convenient to use, especially since you access top,left,bottom,right MUCH more frequently than topLeft or botRight. By the way, Pascal's definition of Point is a union, also, with one union giving two ints and the other an array of 2 ints. So accessing the fields of a point also required an extra union-specifier with Megamax. Some programmers may like this. I personally find this to be one of the more obnoxious aspects of C. I like LSC's approach. Robert Gardner