Path: utzoo!attcan!uunet!cs.utexas.edu!samsung!think!mintaka!bloom-beacon!bu.edu!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.lang.c Subject: Re: "array" vs. "&array" ? Message-ID: <5248@buengc.BU.EDU> Date: 12 Jan 90 16:09:46 GMT References: <24521@gryphon.COM> <21764@mimsy.umd.edu> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.lang.c Organization: Boston Univ. Col. of Eng. Lines: 38 In article <21764@mimsy.umd.edu> chris@mimsy.umd.edu (Chris Torek) writes: >In article >chuckp@ncr-fc.FtCollins.NCR.com (Chuck Phillips) writes: >>Granted. But the question remains: "What is the compiler supposed to do when >>the programmer askes for a pointer to something in the symbol table?" > >The language does not provide a means for the programmer to do such a >thing (the language makes no statements about the internals of compilers, >or even the existance of compilers, other than to require anything that >pretends to implement C to follow some particular standard). What Chris is trying to say (though I think he's been hanging around with Doug and Daffy too long) is: Usually when you ask for the pointer to an array you get a pointer to the first element of the array. While the symbol table will hold the compiler's copy of the address of the beginning of the array, the data in the array obviously can not be stored in the symbol table. E.g.: type_t *aptr, a[MAXINDEX+1]; aptr = &a; if ( *aptr == a[0] ) puts( "Will always print this." ); I can't think of anything else in the symbol table that would need to have its address taken, except maybe function names, struct names, etc., which also have defined meanings when the addressof operator is applied to them. Taking the address of a constant is an error. --Blair "Luckily, I'm inconstant: uunet!buengc!bph."