home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!psinntp!dg-rtp!sheol!throopw
- From: throopw@sheol.UUCP (Wayne Throop)
- Newsgroups: comp.lang.c
- Subject: Re: Computer terms, etc
- Summary: may still be missing the point
- Message-ID: <714017938@sheol.UUCP>
- Date: 17 Aug 92 02:16:11 GMT
- References: <cee1.713424953@Isis.MsState.Edu> <19479@fritz.filenet.com> <1992Aug13.192456.19127@Synopsys.Com> <19590@fritz.filenet.com>
- Lines: 35
-
- -> From: scotth@felix.filenet.com (Scott Hopson)
- -> Message-ID: <19590@fritz.filenet.com>
- ->>> *foo[] is a pointer to an array
- ->> No, it's an array of pointers, because [] has higher precedence than *.
- -> Sorry, it was 2:00 AM when I wrote that, I guess I forgot to put
- -> "of pointers" on the end.
- ->
- -> *foo[] is a pointer to an array [of pointers]
- ->
- -> thanks for the correction.
-
- Um... I think Scott is still missing out on exactly what he's being
- corrected upon. Objects type (*foo[]) are not pointers in any way,
- shape, or form. They are arrays. Again: the object named "foo" by
- the above declaration is NOT A POINTER (though it sometimes
- plays one in certain expressions).
-
- To convince yourself that this is so, consider the results of
- applying sizeof to such an object.
-
- Now, with that said, if such a type is declared to be a formal
- parameter, it is "rewritten" by the compiler to be of type (char**).
- In which case the type is "pointer to pointers to chars", no array
- involved.
-
- Hear me now and understand me later:
-
- Renounce the foul heresy that "array declarations really declare
- constant pointers in C", firstly because it is the Font of Many Errors,
- and leads inevitably to Bad Code, but also because it isn't true. If
- you don't renounce this heresy, I prophesy that Subtle Pointer Bugs will
- hound you all the days of your programming life. YOU have been WARNED.
-
- --
- Wayne Throop ...!mcnc!dg-rtp!sheol!throopw
-