Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #108418
| From | Nick Bowler <nbowler@draconx.ca> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Why does 'static' cause an error ? |
| Date | 2017-04-24 18:20 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <odlfls$olp$1@dont-email.me> (permalink) |
| References | <64abf1f2-1c45-4b1b-95cf-a88133813085@googlegroups.com> <Dd8LA.805271$0k4.555569@fx37.am4> <lnk26apu2m.fsf@kst-u.example.com> <87vapuypde.fsf@bsb.me.uk> |
On Mon, 24 Apr 2017 13:14:05 +0100, Ben Bacarisse wrote: > But uartTivaRB might be a 2D array. I know it's unlikely, but with no > further information uartTivaRB[0] is not ruled out as an initializer by > 6.6. > > The final part of the last sentence about address constants is not 100% > clear (to me) but I don't think it applies here. It says > > "The array-subscript [] ... may be used in the creation of an address > constant, but the value of an object shall not be accessed by use of > these operators." > > If uartTivaRB[0] has array type, I don't think the [] operator accesses > the value of an object. 6.3.2.1p2 quite clearly states how non-array lvalues are "converted to the value stored in the designated object", which clearly counts as reading that value and therefore is definitely an "access" per 3.1p1. But this doesn't apply to arrays, 6.3.2.1p3 does, which explains how array lvalues get converted to a pointer to the array's first element. In this case, there is no statement whatsoever regarding object values. So I would agree that, due to lack of any statement to the contrary, the value of an array object is not read (and certainly not modified) when an lvalue designating that array decays into a pointer. Therefore, such decay is not an "access" per 3.1p1.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why does 'static' cause an error ? fl <rxjwg98@gmail.com> - 2017-04-23 11:17 -0700
Re: Why does 'static' cause an error ? Noob <root@127.0.0.1> - 2017-04-23 22:00 +0200
Re: Why does 'static' cause an error ? Richard Heathfield <rjh@cpax.org.uk> - 2017-04-23 22:22 +0100
Re: Why does 'static' cause an error ? bartc <bc@freeuk.com> - 2017-04-23 21:34 +0100
Re: Why does 'static' cause an error ? Keith Thompson <kst-u@mib.org> - 2017-04-23 16:45 -0700
Re: Why does 'static' cause an error ? fl <rxjwg98@gmail.com> - 2017-04-23 17:44 -0700
Re: Why does 'static' cause an error ? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2017-04-23 20:26 -0700
Re: Why does 'static' cause an error ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-04-24 13:14 +0100
Re: Why does 'static' cause an error ? Nick Bowler <nbowler@draconx.ca> - 2017-04-24 18:20 +0000
Re: Why does 'static' cause an error ? Jerry Stuckle <jstucklex@attglobal.net> - 2017-04-23 17:52 -0400
Re: Why does 'static' cause an error ? jacobnavia <jacob@jacob.remcomp.fr> - 2017-04-24 00:57 +0200
Re: Why does 'static' cause an error ? Keith Thompson <kst-u@mib.org> - 2017-04-23 16:43 -0700
Re: Why does 'static' cause an error ? David Brown <david.brown@hesbynett.no> - 2017-04-24 10:16 +0200
csiph-web