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: Fri, 26 Aug 2016 09:46:54 -0700 Organization: None to speak of Lines: 44 Message-ID: References: <4628cd2d-9333-4be6-943a-eb593c5c4c12@googlegroups.com> <86fe4ec0-6dcd-4aa0-8a21-f8e57038c3bb@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="10281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yLnioj6qZNCMUF2xOTpdx" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:FU2MuGV5bZuMlqNOyAbMzNqD6L8= sha1:9DVyWCAtXPwc9vbnv4IiAUHX5X8= Xref: csiph.com comp.lang.c:92737 Malcolm McLean writes: [...] > i is an uninitialised integer, so for most purpose, not an integer at all. > It's less objectionable to say "i is an integer" because usually i will > receive a value before use, and it's either initialised or uninitialised. This is why "array", "pointer", "integer", and similar words are best thought of as adjectives rather than nouns. You can reasonably say "foo is an array" if the meaning is unambiguous, but here it isn't. Given int i; at block scope, `i` is an integer object. It does not contain a defined integer value. Given: int arr[10]; at block scope, `arr` is an integer object. It does not contain a defined array value. (See the standard for the definition of the word "value"; it applies to the contents of an array object just as much as it applies to the contents of an integer object.) > However a buffer will very commonly have some initialised values, > and some uninitialised "values" which, for most purposes, are not > values at all. And they can hang about, it might be very rare for the last > few places in the buffer to ever receive values. > So it's more important to distinguish number of elements from capacity, > and nit-picking on array' versus "buffer" can help with that. No, Malcolm, it really doesn't help with that. It's an important distinction, but the way you're making it, by pretending that an array object isn't "an array", is confusing and quite simply wrong. You're using the word "array" in your own bizarre sense that is inconsistent with the way the standard uses that word. The standard's usage of the word "array" is not, as you've repeatedly claimed, incorrect. You are the only person I've seen using the word "array" the way you do. -- 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"