Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC830713); site hwcs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!mcvax!ukc!edcaad!hwcs!andrew From: andrew@hwcs.UUCP (Andrew Stewart) Newsgroups: net.lang.c Subject: Re: C subscripts Message-ID: <245@hwcs.UUCP> Date: Thu, 1-Nov-84 06:10:07 EST Article-I.D.: hwcs.245 Posted: Thu Nov 1 06:10:07 1984 Date-Received: Sat, 3-Nov-84 08:02:33 EST References: <195@mouton.UUCP> Organization: Computer Sci., Heriot-Watt U., Scotland Lines: 48 >I am talking about C's arcane subscripting syntax. >Who else out there thinks that > some_array_name[more][long][names] >is actually a good way to do things? I'm sorry, but I do. >Just as we need nested comments, because after all other "great languages" >do, I propose that C support "normal" subscripting. > >Mathematicians have been around longer than C; Fortran too; >so, in the name of compatability, which is what the ANSI standard >is all about anyway, the compiler SHOULD accept > some_array_name[more,long,names] Ah! We follow the hallowed traditions of F*rtr*n... I see. I have a minor objection, though - if you consider an array to be a vector of vectors (of vectors, etc, etc) then the C method is reasonable. The "normal" method treats the array as a homogeneous mass, rather than a hierarchical structure. >Of course the older, hopefully obsolescent, method will be supported, >but it should be discouraged. I would prefer to see the C method adopted by other languages. >Now, BEFROE the flames start I KNOW the comma operator exists. >This is not overloading because subscripts are expressions, not statements. >So don't start quoting K&R pg 192 to me. Ahem - the expression array_name[more,long,names] will evaluate the expression 'more', then the expression 'long' and then use the expression 'names' as the subscript value. It *is* a sequence of comma-operator expressions. Not a readable facility, but (like so many gruesomes in C) when you need it, you *need* it. -- ---------------------------------- "Not a bug, a feature! It's documented, dash it!" Andrew Stewart, Dept. of Computer Science, Heriot-Watt University, Edinburgh, Scotland. ..!ukc!edcaad!hwcs!andrew