Deutsch English Français Italiano |
<v6c2d7$3tko2$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: James Kuyper <jameskuyper@alumni.caltech.edu> Newsgroups: comp.lang.c Subject: =?UTF-8?Q?Re=3A_technology_discussion_=E2=86=92_does_the_world_need?= =?UTF-8?B?IGEgIm5ldyIgQyA/?= Date: Sat, 6 Jul 2024 14:28:54 -0400 Organization: A noiseless patient Spider Lines: 27 Message-ID: <v6c2d7$3tko2$2@dont-email.me> References: <v66eci$2qeee$1@dont-email.me> <v67gt1$2vq6a$2@dont-email.me> <v687h2$36i6p$1@dont-email.me> <871q48w98e.fsf@nosuchdomain.example.com> <v68dsm$37sg2$1@dont-email.me> <87wmlzvfqp.fsf@nosuchdomain.example.com> <v6ard1$3ngh6$4@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Date: Sat, 06 Jul 2024 20:28:55 +0200 (CEST) Injection-Info: dont-email.me; posting-host="2f8b04a7cbca5d04ee14b3b75be7b597"; logging-data="4117250"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18EjRKe9bTaFYc5QVHC65lJxFu5Ri9ZCUk=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:0+Y/YuiMZse27dY2B09eSAqFuQ8= Content-Language: en-US In-Reply-To: <v6ard1$3ngh6$4@dont-email.me> Bytes: 2587 On 7/6/24 03:23, Lawrence D'Oliveiro wrote: > On Fri, 05 Jul 2024 11:46:38 -0700, Keith Thompson wrote: > >> No, arrays are not pointers. > > Except array indexing is designed to be indistinguishable from pointer > arithmetic. Actually, C doesn't have array indexing; it only has pointer indexing. The subscript operator requires that one of it's operands shall have the type "pointer to a complete object type", and that the other shall have integer type. It cannot be applied to arrays; but conveniently, the standard mandates that: "Except when it is the operand of the sizeof operator, or typeof operators, or the unary & operator, or is a string literal used to initialize an array, an expression that has type "array of type" is converted to an expression with type "pointer to type" that points to the initial element of the array object ..." (6.3.2.1p3). It is that conversion which creates the illusion of array indexing, but since it's been converted to a pointer, it is actually pointer indexing. The key point is that an expression of array type does not always get converted into a pointer to the first element of that array. The clause above starts out with four exceptions, and an array behaves quite differently from a pointer when any of those exceptions apply.