Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #20053

Re: The question regarding type of pointers

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: The question regarding type of pointers
Date 2012-04-29 11:54 -0400
Organization A noiseless patient Spider
Message-ID <jnjo84$7kc$1@dont-email.me> (permalink)
References (2 earlier) <96bb54c9-5ea3-49ff-851b-56dfbb8eac54@qg3g2000pbc.googlegroups.com> <4F9C3E13.41E3@mindspring.com> <ce807310-bc61-4674-8657-05535111bacd@k7g2000pbo.googlegroups.com> <jnj952$krk$1@dont-email.me> <4F9D4380.5FF5@mindspring.com>

Show all headers | View raw


On 04/29/2012 09:34 AM, pete wrote:
> James Kuyper wrote:
...
>> C has expressions that refer to arrays. These expressions do not have a
>> value; the expression (NOT it's non-existent value) gets automatically
>> converted into a pointer to the first element of that array in many
>> contexts. However, an array expression does not itself have any value,
>> and in several important contexts no such conversion occurs.
> 
> From this:
>     n1570
>     6.7.9 Initialization
>     Semantics
>     8 An initializer specifies the initial value stored in an object.
> I would construe that the entire contents of an array,
> is the value of an array.

6.7.9p10 says: "-- if it is an aggregate, every member is initialized
(recursively) according to these rules,"
6.7.9p14 says: "Successive bytes of the string literal (including the
terminating null character if there is room or if the array is of
unknown size) initialize the elements of the array.". 6.7.9p15 say the
same for arrays of wchar_t, char16_t, and char32_t.

Therefore, I think it's more appropriate to consider 6.7.9p8 to be
referring what happens recursively to the elements of an array, rather
than implying that the array as a whole has a value.

However, your formulation: that a array has a value, but that C provides
no mechanism for reading or writing that value, only mechanisms for
reading or writing individual elements of the array, is a workable
alternative interpretation.
-- 
James Kuyper

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

The question regarding type of pointers somenath <somenathpal@gmail.com> - 2012-04-24 21:05 -0700
  Re: The question regarding type of pointers Kaz Kylheku <kaz@kylheku.com> - 2012-04-25 04:51 +0000
  Re: The question regarding type of pointers "Heinrich Wolf" <invalid@invalid.invalid> - 2012-04-25 07:15 +0200
    Re: The question regarding type of pointers Philip Lantz <prl@canterey.us> - 2012-04-25 00:46 -0700
      Re: The question regarding type of pointers "Heinrich Wolf" <invalid@invalid.invalid> - 2012-04-25 09:52 +0200
  Re: The question regarding type of pointers Philip Lantz <prl@canterey.us> - 2012-04-25 01:09 -0700
  Re: The question regarding type of pointers Barry Schwarz <schwarzb@dqel.com> - 2012-04-25 11:22 -0700
    Re: The question regarding type of pointers somenath <somenathpal@gmail.com> - 2012-04-27 23:05 -0700
      Re: The question regarding type of pointers pete <pfiland@mindspring.com> - 2012-04-28 14:59 -0400
        Re: The question regarding type of pointers somenath <somenathpal@gmail.com> - 2012-04-28 20:27 -0700
          Re: The question regarding type of pointers James Kuyper <jameskuyper@verizon.net> - 2012-04-29 07:37 -0400
            Re: The question regarding type of pointers pete <pfiland@mindspring.com> - 2012-04-29 09:34 -0400
              Re: The question regarding type of pointers James Kuyper <jameskuyper@verizon.net> - 2012-04-29 11:54 -0400
          Re: The question regarding type of pointers pete <pfiland@mindspring.com> - 2012-04-29 09:24 -0400
            Re: The question regarding type of pointers somenath <somenathpal@gmail.com> - 2012-04-29 07:38 -0700
              Re: The question regarding type of pointers James Kuyper <jameskuyper@verizon.net> - 2012-04-29 12:01 -0400
                Re: The question regarding type of pointers somenath <somenathpal@gmail.com> - 2012-04-29 09:29 -0700
    Re: The question regarding type of pointers somenath <somenathpal@gmail.com> - 2012-04-27 22:22 -0700
      Re: The question regarding type of pointers Barry Schwarz <schwarzb@dqel.com> - 2012-04-28 20:14 -0700
        Re: The question regarding type of pointers somenath <somenathpal@gmail.com> - 2012-04-28 22:17 -0700
          Re: The question regarding type of pointers James Kuyper <jameskuyper@verizon.net> - 2012-04-29 07:32 -0400

csiph-web