Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #396722
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
| Newsgroups | comp.lang.c |
| Subject | Re: Loops (was Re: do { quit; } else { }) |
| Date | Sun, 01 Mar 2026 23:37:59 -0800 |
| Organization | None to speak of |
| Lines | 71 |
| Message-ID | <87y0kasmug.fsf@example.invalid> (permalink) |
| References | <vspbjh$8dvd$1@dont-email.me> <vtlcg0$3f46a$2@dont-email.me> <20250415153419.00004cf7@yahoo.com> <86h62078i8.fsf@linuxsc.com> <20250504180833.00000906@yahoo.com> <86plggzilx.fsf@linuxsc.com> <vvnsvt$3k1mu$1@dont-email.me> <86ldr4yx0x.fsf@linuxsc.com> <vvpmm2$3dhl$1@dont-email.me> <vvpsji$4jht$1@dont-email.me> <vvr5mg$l85c$1@dont-email.me> <vvt2tg$14otk$2@dont-email.me> <1000cs3$2234m$1@dont-email.me> <87sel8nqid.fsf@nosuchdomain.example.com> <86msbgw49b.fsf@linuxsc.com> <875xi4cevz.fsf@nosuchdomain.example.com> <86ecwsvunb.fsf@linuxsc.com> <87sel7c3y6.fsf@nosuchdomain.example.com> <865xi3x22i.fsf@linuxsc.com> <87h61nbvlo.fsf@nosuchdomain.example.com> <86cy1mg4h5.fsf@linuxsc.com> |
| MIME-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Date | Mon, 02 Mar 2026 07:38:00 +0000 (UTC) |
| Injection-Info | dont-email.me; posting-host="904fdc8ce99c4265d8d70c325ce3d825"; logging-data="988697"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+d3YvPyPG0TroZlJriDX1y" |
| User-Agent | Gnus/5.13 (Gnus v5.13) |
| Cancel-Lock | sha1:9Ldk9ANJjQJWlX8WRJK83FJSFow= sha1:mvMA5qcRYOWO+fyFIsh6oDMcpOM= |
| Xref | csiph.com comp.lang.c:396722 |
Show key headers only | View raw
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
[...]
>> Can you define, preferably in something approaching standardese, what
>> you mean by "array" and by "array object", and in particular how they
>> differ?
>
> The difference is contextual. A declaration such as 'int a[5];', at
> file scope, declares and defines an array object. The value of a
> pointer returned by malloc() may be used to access an array of
> elements, but there is nothing that says the region of memory
> allocated by malloc() is an array object, only that it may be
> accessed as an array.
I was looking for *definitions* of the terms "array" and "array
object" that would help me understand how you're using the terms
and how they differ. Examples can be helpful, but I would like to
see definitions that do not depend on examples.
I do not see any such definitions in anything you've written.
The standard defines the terms "object" and "array type". If there's
a definition for the word "array" by itself, I haven't found it.
>> I believe that, in my example above, arr+5 *does* "provide access
>> to an array" with at least 5 elements. (I also believe that that
>> "array" is an "array object".) My difficulty is in demonstrating
>> this based on the normative wording in the standard. *Maybe*
>> if you could explain the distinction you make between "array" and
>> "array object" it would help.
>
> Suppose we have a file scope declaration
>
> int foo[10];
>
> and an expression
>
> (foo+5)[-3];
>
> the behavior of the [] operation is described by the implied +
> operation in the section for Additive operators, with P being
> the subexpression (foo+5). The region of memory corresponding
> to the fifth through ninth elements of foo surely is an array,
> but it is not the "array object" referred to by that paragraph
> in the C standard. This point shows why it is imporant to
> distinguish between "array" and "array object". All array
> objects are arrays, but not all arrays are array objects, as
> those terms are used in the C standard.
If I understand you correctly, you assert that given
int foo[10];
the region of memory named "foo" is both an "array" and an "array
object" (of type int[10]), but for example the region of memory
containing the last 5 elements of foo is an "array" but not an
"array object". Is that an accurate statement about your view?
I would say that the latter region is a region of memory in the
execution environment, the contents of which can represent a value of
the array type int[5] -- i.e., it can be treated as an array object,
and that it *is* an array object. (A "value", of course, is the
"precise meaning of the contents of an object when interpreted as
having a specific type"; for an array type, that value consists of
the values of its elements.)
[...]
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar
Re: Loops (was Re: do { quit; } else { }) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-01 21:55 -0800
Re: Loops (was Re: do { quit; } else { }) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-01 23:37 -0800
csiph-web