🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1960

Re: ref. to array != ptr

#1960
From: Doug Gwyn
Date: Sat, 10 Nov 1990 05:44
29 lines
2161 bytes
In article <906@inews.intel.com> bhoughto@cmdnfs.intel.com (Blair P. Houghton) writes:
-In article <14391@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes:
->In article <894@inews.intel.com> bhoughto@cmdnfs.intel.com (Blair P. Houghton) writes:
->=  is there anything more explicit stating that the declaration of an
->=externally-defined pointer to Type can not specify an array of Type
->=with the same identifier defined externally?
->Sure.  3.1.2.6:  "All declarations that refer to the same object or
->function shall have compatible type; otherwise, the behavior is undefined."
-Well, yes, I should have mentioned this as part of the inference;
-I'm wondering if there isn't anything to the effect of "don't do
-this" explicitly mentioning array/pointer confusions in multiple
-translation units.

No; taken in conjunction with the words that relate the identifier to
the object (and scope rules, and ...), the above is sufficient.

-The more 3.1.2.6 and the definitions of compatible pointers and
-compatible arrays sink in, though, the clearer the inference
-becomes.  I was just hoping that, as was done for a number of
-other things, there'd be an example of /*RIGHT*/ and /*WRONG*/
-coding.

There are an almost unlimited number of possible examples of stupid
mistakes.  Any decent C tutorial should already fully explain what the
relation is between array and pointer (and what it isn't).  There was
no new, subtle point introduced in the C standard that needed special
explanation, unlike most (or all?) of the other examples.  The usual
X3J11 response to requests for examples like the one you suggest was
"the standard is not a tutorial".
Technical Details
Message-ID: <14414@smoke.brl.mil>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!maverick.ksu.ksu.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn
References: <894@inews.intel.com> <14391@smoke.brl.mil> <906@inews.intel.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!maverick.ksu.ksu.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn
From: gwyn@smoke.brl.mil (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: ref. to array != ptr
Message-ID: <14414@smoke.brl.mil>
Date: 10 Nov 90 05:44:52 GMT
References: <894@inews.intel.com> <14391@smoke.brl.mil> <906@inews.intel.com>
Organization: U.S. Army Ballistic Research Laboratory, APG, MD.
Lines: 29