Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!brl-tgr!tgr!jrv@Mitre-Bedford From: jrv@Mitre-Bedford Newsgroups: net.lang.c Subject: C type declarations Message-ID: <7262@brl-tgr.ARPA> Date: Sat, 12-Jan-85 19:36:02 EST Article-I.D.: brl-tgr.7262 Posted: Sat Jan 12 19:36:02 1985 Date-Received: Mon, 14-Jan-85 03:21:59 EST Sender: news@brl-tgr.ARPA Organization: Ballistic Research Lab Lines: 30 I (think I) understand the C types involving the operators *, (), and [], but I find the C syntax confusing. Judging from recent discussions on multidimensional arrays and functions returning pointers, I'm not alone. I'd like to bring up a suggestion I ran across several years ago: to replace the prefix operator * with the postfix operator ^. The three operators ^, (), and [] can have the same precedence, and are executed from left to right. The declaration syntax is also changed to put the basic type last, so that a declaration can be read from left to right... var a()^[]^ : int; declares a to be a FUNCTION returning a POINTER to an ARRAY of POINTERS to INTEGERS. The colon can move without changing the meaning, as in var a()^[] : ^int; but the colon is useful so that several related objects can be declared at once, so var a()^[],b(),c[3] : ^int; declares a as above, b to be a FUNCTION returning a POINTER to an INTEGER, and c to be an ARRAY of three POINTERS to INTEGERS. I've always liked the idea. I realize it's unlikely to be added to C at this late date, but I could hope to see it in a preprocessor or a new language. (By the way, I thought I saw this in SIGPLAN Notices several years ago, but I looked through all my back issues and can't find it. Can anyone else supply the reference?) - Jim Van Zandt