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


Groups > comp.lang.c > #142566

Re: Array-as-pointer Syntax

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Array-as-pointer Syntax
Date 2019-03-28 13:57 -0700
Organization None to speak of
Message-ID <lnwokiaf92.fsf@kst-u.example.com> (permalink)
References <761347c7-4f03-42f3-a156-5f357c8ae091@googlegroups.com> <4be1835e-b0cb-44ad-b088-ad8e82cde4f0@googlegroups.com>

Show all headers | View raw


James Kuyper <jameskuyper@alumni.caltech.edu> writes:
> On Thursday, March 28, 2019 at 1:04:43 PM UTC-4, David T. Ashley wrote:
[...]
> As an lvalue of array type, 'x' gets implicitly converted into a pointer
> to the first element of that array, x[0], in most contexts (6.3.2.1p3),
> including the following one:
>
>>    memset(x, 0, sizeof(x));
>> 
>> and
>
> However, there are four exceptions to that rule, and &x is one of them
> (the other three are as the operands of sizeof or _Alignof, or as a
> string literal used to initialize an array of character type). This
> results in a pointer to the entire array:
>
>>    memset(&x, 0, sizeof(x));

There are three exceptions, not four.  _Alignof (for unclear reasons)
can only be applied to a parenthesized type name, not to an expression.
Including _Alignof in the list of exceptions was an error in the N1570
draft, corrected in the published C11 standard.

[...]

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

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


Thread

Array-as-pointer Syntax "David T. Ashley" <dashley@gmail.com> - 2019-03-28 10:04 -0700
  Re: Array-as-pointer Syntax Bart <bc@freeuk.com> - 2019-03-28 17:18 +0000
    Re: Array-as-pointer Syntax David Brown <david.brown@hesbynett.no> - 2019-03-28 21:31 +0100
  Re: Array-as-pointer Syntax Ian Collins <ian-news@hotmail.com> - 2019-03-29 06:23 +1300
    Re: Array-as-pointer Syntax James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-03-28 12:09 -0700
      Re: Array-as-pointer Syntax Ian Collins <ian-news@hotmail.com> - 2019-03-29 08:21 +1300
      Re: Array-as-pointer Syntax Ike Naar <ike@iceland.freeshell.org> - 2019-03-28 22:59 +0000
        Re: Array-as-pointer Syntax James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-03-28 17:44 -0700
    Re: Array-as-pointer Syntax Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-28 20:12 +0000
  Re: Array-as-pointer Syntax James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-03-28 11:57 -0700
    Re: Array-as-pointer Syntax Keith Thompson <kst-u@mib.org> - 2019-03-28 13:57 -0700
      Re: Array-as-pointer Syntax James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-03-28 19:50 -0400
  Re: Array-as-pointer Syntax Keith Thompson <kst-u@mib.org> - 2019-03-28 14:04 -0700
  Re: Array-as-pointer Syntax John Bode <jfbode1029@gmail.com> - 2019-03-29 07:24 -0700
    Re: Array-as-pointer Syntax Ike Naar <ike@iceland.freeshell.org> - 2019-03-29 18:08 +0000

csiph-web