Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!iuvax!pur-ee!j.cc.purdue.edu!k.cc.purdue.edu!l.cc.purdue.edu!cik From: cik@l.cc.purdue.edu (Herman Rubin) Newsgroups: comp.lang.c Subject: Re: Question on structures Message-ID: <608@l.cc.purdue.edu> Date: Sat, 7-Nov-87 07:03:42 EST Article-I.D.: l.608 Posted: Sat Nov 7 07:03:42 1987 Date-Received: Wed, 11-Nov-87 06:33:25 EST References: <1025@phoenix.Princeton.EDU> <8888@utzoo.UUCP> Organization: Purdue University Statistics Department Lines: 55 Keywords: Sturctures records Summary: I find the "." a nuisance too In article <8888@utzoo.UUCP>, henry@utzoo.UUCP (Henry Spencer) writes: > > I have gotten really tired of typing things like a.b.c.d etc to refer to > > elements of a structure. .... ...... > Nothing quite the same, but you can come close. If all you want is the > abbreviation, just > > #define IT a.b.c > > and then refer to IT.d or whatever. If you also want the efficiency boost > that some Pascal compilers give you this way, then > > struct whatever *it = &a.b.c; > > and then refer to it->d or whatever. .... > Those who do not understand Unix | Henry Spencer @ U of Toronto Zoology > are condemned to reinvent it. | {allegra,ihnp4,decvax,utai}!utzoo!henry This is another example of the use of unnecessarily complicated syntax. The use of unions in C is far more messy than that of equivalence in FORTRAN. What is needed is a massive extension of the common block idea in FORTRAN without forcing common together with extension of equivalence. In addition, if the block is external, only the first part need be given, with an indication that this is the case. As an example, I use a subroutine linkage call in which I would like my declaration to read #extern array block{*routine r, *TYPE abc[3]}; and my call to read r(array); and referring the the I-th pointer in abc as abc[I], instead of what I am now doing, which is using union point array[]; and then making the call array[0].r(array); and having to use array[I+1].T instead of abc[I]. Since "a pointer is a pointer is a pointer", someone like myself who does not believe in requiring strong typing would like to have a type "pointer" which can be any type of pointer. This would help since I could use pointer array. We should let the compiler read through the chain of structures instead of requiring the programmer to use ->'s and .'s. -- Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907 Phone: (317)494-6054 hrubin@l.cc.purdue.edu (ARPA or UUCP) or hrubin@purccvm.bitnet