Path: utzoo!attcan!uunet!husc6!mailrus!ncar!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: 5[array] (was Re: "for" loops in C ...) Message-ID: <14456@mimsy.UUCP> Date: 9 Nov 88 23:43:21 GMT References: <14999@agate.BERKELEY.EDU> <4700019@m.cs.uiuc.edu> <6945@cdis-1 <351@chem.ucsd.EDU> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 26 In article <351@chem.ucsd.EDU> tps@chem.ucsd.edu (Tom Stockfisch) writes: [compressed vertically] >So how come > int 5[a], 5[*b]; >isn't a legal declaration equivalent to > int a[5], (*b)[5]; >and the following isn't a legal cast? > (int 10[*]) Because the `declaration mirrors use' rule is only an approximation. (Tom was no doubt asking rhetorically, but no doubt someone will misunderstand.) Mainly, it breaks down with array declarations and use. This is probably the cause of most of the confusion as to why code like /* file1.c */ char text[] = "foo the bar"; /* file2.c */ extern char *text; /* ... code referencing *(text+n) ... */ fails. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris