Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Difference between these pointer syntaxes Date: Wed, 17 Aug 2016 19:14:49 -0700 Organization: None to speak of Lines: 43 Message-ID: References: <87r39s8w6c.fsf@bsb.me.uk> <4991b886-1f54-4098-bf57-ba59710b99d1@googlegroups.com> <87bn0rut34.fsf@bsb.me.uk> <9283b112-8250-4e0b-b149-6ca728a3200b@googlegroups.com> <07faa95e-2470-4375-93e9-15e79ee4e0e4@googlegroups.com> <55578778-4482-458e-b43d-b763732c0054@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="25327"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9/jTMxW0oOGqKy/Sck5TR" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:6UE3gZRcRb06F9BgvfZJ2CvoNcI= sha1:HkwPOGJHIIb8vnfBlMgUsaTBg7A= Xref: csiph.com comp.lang.c:92440 Malcolm McLean writes: > On Thursday, August 18, 2016 at 12:41:25 AM UTC+1, Keith Thompson wrote: >> Malcolm McLean writes: >> [...] >> > The rules are, firstly get clear in your own mind that a buffer is >> > a region of memory, an array is a list of data placed at equal >> > intervals in that memory. >> >> [...] >> >> No. >> >> The unqualified term "an array" is ambiguous. An array object >> is an object of array type, regardless of its current contents. >> Please stop misusing words that have perfectly good definitions. >> > If data are arrayed, they form an "array". That's not how C defines the word "array". You can't take reasonably the meanings of common English words and use them to make assertions about what those words mean in the context of C. > You can't have an array > of data if you've no data in it, any more than you can have a square > of soldiers if you have no soldiers. To be fair, you can in > programming have the empty array, that's often a valid concept. > But that's not what you're talking about. You imagine that > double x[100] creates an array of doubles, because on your reading > of the C standard it says that it does. But that buffer could > contain a hundred trap representations, it's not an array of 100 > doubles yet, only when you put data into it. It's an array *object* consisting of 100 *objects* of type double, regardless of their values. Whether something is an array object or not does not depend on whether its elements have been initialized. If each element contains a trap representation, it's still an array object of type `double[100]`. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"