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


Groups > comp.lang.forth > #31895

Re: C array descriptor

From "Rod Pemberton" <dont_use_email@xnothavet.cqm>
Newsgroups comp.lang.forth
Subject Re: C array descriptor
Date 2014-06-26 18:07 -0400
Organization Aioe.org NNTP Server
Message-ID <op.xh202roy6zenlw@localhost> (permalink)
References <eff9d8fc-6d13-4e4b-9a01-33be4550e27d@googlegroups.com> <bZKdnd1wUcOMGjfOnZ2dnUVZ_tWdnZ2d@supernews.com> <op.xh06o9r46zenlw@localhost> <4cudnW5zj6HmfjbOnZ2dnUVZ_oSdnZ2d@supernews.com>

Show all headers | View raw


On Thu, 26 Jun 2014 05:10:19 -0400, Andrew Haley  
<andrew29@littlepinkcloud.invalid> wrote:
> Rod Pemberton <dont_use_email@xnothavet.cqm> wrote:

>> C doesn't have arrays either.
>
> Yes, it does.  Read the standard, in particular 6.7.5.2, Array
> declarators.
>

That's not array.  It's a declarator.  I mentioned that too:

RP> "What C has is the ability to declare the space for an array."

>> As you can clearly see, the "array" is *NOT* passed to a function
>> and therefore shouldn't have "decayed into" a pointer to the first
>> element.  Yet, the "array" in the code body *IS* a pointer to the
>> first element.
>
> No, it's not, it's an array.

No, it's not, it's a pointer.  Like I said.

Your own quote agrees with me. You need to re-read this again:

> As the standard puts it,
>
> "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 this is exactly what happens at a function call.  Like I said.

It happens at compile time, long before a function call.
C treats everything as pointer based.


Rod Pemberton

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


Thread

C array descriptor Roger Levy <roger.levy@gmail.com> - 2014-06-24 19:45 -0700
  Re: C array descriptor Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-06-25 03:23 -0500
    Re: C array descriptor Segfaults R Us <seg4u@segue.org> - 2014-06-25 08:45 +0000
    Re: C array descriptor Roger Levy <roger.levy@gmail.com> - 2014-06-25 07:03 -0700
    Re: C array descriptor "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-06-25 18:13 -0400
      Re: C array descriptor Roger Levy <roger.levy@gmail.com> - 2014-06-25 17:03 -0700
      Re: C array descriptor Lars Brinkhoff <lars.spam@nocrew.org> - 2014-06-26 08:12 +0200
        Re: C array descriptor "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-06-26 18:07 -0400
          Re: C array descriptor Lars Brinkhoff <lars.spam@nocrew.org> - 2014-06-27 07:50 +0200
      Re: C array descriptor Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-06-26 04:10 -0500
        Re: C array descriptor "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-06-26 18:07 -0400
          Re: C array descriptor bruce.mcfarling@gmail.com - 2014-06-26 22:14 -0700
          Re: C array descriptor Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-06-27 03:39 -0500
            Re: C array descriptor Mark Wills <markwills1970@gmail.com> - 2014-06-27 03:32 -0700
              Re: C array descriptor Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-06-27 06:00 -0500
                Re: C array descriptor Roger Levy <roger.levy@gmail.com> - 2014-06-27 07:34 -0700
                Re: C array descriptor bruce.mcfarling@gmail.com - 2014-06-27 09:42 -0700
                Re: C array descriptor Roger Levy <roger.levy@gmail.com> - 2014-06-27 09:51 -0700
                Re: C array descriptor bruce.mcfarling@gmail.com - 2014-06-27 15:32 -0700
        Re: C array descriptor Bernd Paysan <bernd.paysan@gmx.de> - 2014-06-27 03:40 +0200

csiph-web