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


Groups > comp.lang.c > #12984

Re: Array of Integers ?

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Array of Integers ?
Date 2011-11-09 13:36 -0800
Organization None to speak of
Message-ID <lnzkg59dx7.fsf@nuthaus.mib.org> (permalink)
References (2 earlier) <f5be4501-1991-4e7d-b64a-3421b093dc67@s35g2000pra.googlegroups.com> <lnk47acm1m.fsf@nuthaus.mib.org> <0.37f60e84176a3ca268ae.20111109005701GMT.87y5vq2jvm.fsf@bsb.me.uk> <4EBA0A25.1075@mindspring.com> <0.98166b3e19d812326ddf.20111109110606GMT.87k479368x.fsf@bsb.me.uk>

Show all headers | View raw


Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> pete <pfiland@mindspring.com> writes:
>> Ben Bacarisse wrote:
>>> Keith Thompson <kst-u@mib.org> writes:
>>> > C does have array values; it just doesn't let you manipulate them
>>> > directly in most cases.  The standard's definition of the word
>>> > "value" (C99 3.17) is "precise meaning of the contents of an object
>>> > when interpreted as having a specific type".  Nothing in that
>>> > definition excludes arrays.
>>> 
>>> That definition is effectively useless. 
>>
>> The standard says 
>>  "An initializer specifies the initial value stored in an object."
>>
>> Which leads me to believe 
>> that an initializer for an array, 
>> specifies the initial value stored in the array.
>
> Does that mean that it *is* an array value?  Maybe.  I get the feeling
> that wording like "specifies" and "designates" are deliberately
> non-specific.

No, an initializer is a syntactic construct that appears in source
code, while a value is something that exists in a running program.
It "specifies" that value in the sense that it tells the compiler
to generate code that will create that value when the program
is executed.

> Initialisers specify values in some very indirect ways.  {0} can specify
> the initial value of any object (at least I can't think of an exception)
> so it's rather unnatural to think of these things as denoting values of
> some type or other.

Given:

    int arr[5] = { 0 };

the initializer "{ 0 }" specifies the initial value of arr.  This is
a value of type int[5], consisting of 5 values of type int, all 0.

The value that an initializer specifies can be determined only
in context.  Given that context, the value that it specifies is
unambiguous.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

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


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