Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Array of Integers ? |
| Date | 2011-11-08 12:13 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <4EB9631F.9090707@verizon.net> (permalink) |
| References | <4eb8df96$0$281$14726298@news.sunsite.dk> <j9aocd$9b5$1@speranza.aioe.org> <f5be4501-1991-4e7d-b64a-3421b093dc67@s35g2000pra.googlegroups.com> |
On 11/08/2011 10:12 AM, Chad wrote: > On Nov 8, 12:14 am, jacob navia <ja...@spamsink.net> wrote: ... >> The person that told you that arrays of integers do not exist in C is >> completely wrong. >> > > What about the following... > > http://67.40.109.61/torek/c/expr.html Note that at the top of that page, the author indicates use of non-standard language. He claims to be using 'object' to refer to what the standard calls an 'lvalue'. However, his actual use of the term doesn't support that claim; he frequently uses that term in ways where 'lvalue' wouldn't fit; in those cases he's actually using it in pretty much the same way the standard defines it. > "Array objects have a special, fundamental rule in C. This rule is > essentially arbitrary, and simply must be memorized. It falls out > from a key fact: C does not have array values. (There is one > exception to this, which I will save for later.) C does have array > objects -- just the values are missing. For instance, int a[5]; > declares an ordinary array containing five ints. Logically, the > ‘value’ of this array ought to be the five int values stored in that > array -- but it is not. Instead, the ‘value’ of the array is a > pointer to the first element of that array. " That paragraph fails to correctly explain what's going on in expressions like &a or sizeof a, but for most other expressions, it's close enough to be useful. He gives something closer to the correct rule farther down. The correct rule is in 6.3.2.1: "Except when it is the operand of the sizeof operator 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 and is not an lvalue." > The point being that, if I understand correctly, C does not have > 'array of integers'. Instead, at least according to the former > comp.lang.c regular on here, the language has 'array objects'. The discussion has been about an "array of objects", not an "array object". An array object has sub-objects called elements. Those elements have a type, and an array of objects which have the type T are routinely referred to as an "array of T"; this usage is common in the standard itself. The first five examples I found of such usage were 6.2.5p20, footnote 36, 6.2.5p29, 6.3.2.1p3, and 6.5p6; there's many more. Nothing said on the page you're referring to is incompatible with that usage.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Array of Integers ? arnuld <sunrise@invalid.address> - 2011-11-08 07:51 +0000
Re: Array of Integers ? Ike Naar <ike@iceland.freeshell.org> - 2011-11-08 08:11 +0000
Re: Array of Integers ? jacob navia <jacob@spamsink.net> - 2011-11-08 09:14 +0100
Re: Array of Integers ? Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-08 00:23 -0800
Re: Array of Integers ? pete <pfiland@mindspring.com> - 2011-11-08 04:07 -0500
Re: Array of Integers ? tom st denis <tom@iahu.ca> - 2011-11-08 06:23 -0800
Re: Array of Integers ? "Scott Fluhrer" <sfluhrer@ix.netcom.com> - 2011-11-08 10:08 -0500
Re: Array of Integers ? Noob <root@127.0.0.1> - 2011-11-08 16:25 +0100
Re: Array of Integers ? bks@panix.com (Bradley K. Sherman) - 2011-11-08 15:39 +0000
Re: Array of Integers ? Keith Thompson <kst-u@mib.org> - 2011-11-08 13:48 -0800
Re: Array of Integers ? Keith Thompson <kst-u@mib.org> - 2011-11-09 19:34 -0800
Re: Array of Integers ? Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-08 06:59 -0800
Re: Array of Integers ? jacob navia <jacob@spamsink.net> - 2011-11-08 22:48 +0100
Re: Array of Integers ? Chad <cdalten@gmail.com> - 2011-11-08 07:12 -0800
Re: Array of Integers ? pete <pfiland@mindspring.com> - 2011-11-08 11:49 -0500
Re: Array of Integers ? James Kuyper <jameskuyper@verizon.net> - 2011-11-08 12:13 -0500
Re: Array of Integers ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-08 21:45 +0000
Re: Array of Integers ? James Kuyper <jameskuyper@verizon.net> - 2011-11-08 16:48 -0500
Re: Array of Integers ? Keith Thompson <kst-u@mib.org> - 2011-11-08 14:25 -0800
Re: Array of Integers ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-08 22:42 +0000
Re: Array of Integers ? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-11-10 12:01 +0200
Re: Array of Integers ? Keith Thompson <kst-u@mib.org> - 2011-11-10 03:14 -0800
Re: Array of Integers ? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-11-10 17:41 +0200
Re: Array of Integers ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-10 16:44 +0000
Re: Array of Integers ? Keith Thompson <kst-u@mib.org> - 2011-11-10 10:59 -0800
Re: Array of Integers ? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-11-11 17:49 +0200
Re: Array of Integers ? Keith Thompson <kst-u@mib.org> - 2011-11-08 14:00 -0800
Re: Array of Integers ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-09 00:57 +0000
Re: Array of Integers ? pete <pfiland@mindspring.com> - 2011-11-09 00:05 -0500
Re: Array of Integers ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-09 11:06 +0000
Re: Array of Integers ? Keith Thompson <kst-u@mib.org> - 2011-11-09 13:36 -0800
Re: Array of Integers ? Tim Rentsch <txr@alumni.caltech.edu> - 2012-01-25 00:45 -0800
Re: Array of Integers ? Keith Thompson <kst-u@mib.org> - 2012-01-25 02:56 -0800
Re: Array of Integers ? pete <pfiland@mindspring.com> - 2011-11-09 18:34 -0500
Re: Array of Integers ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-10 00:57 +0000
Re: Array of Integers ? Keith Thompson <kst-u@mib.org> - 2011-11-08 22:14 -0800
Re: Array of Integers ? Tim Rentsch <txr@alumni.caltech.edu> - 2012-01-25 01:46 -0800
Re: Array of Integers ? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-11-08 01:39 -0800
Re: Array of Integers ? Keith Thompson <kst-u@mib.org> - 2011-11-08 14:05 -0800
Re: Array of Integers ? James Kuyper <jameskuyper@verizon.net> - 2011-11-08 06:19 -0500
csiph-web