Re: [RFC] [PATCH] Add __array_size keyword

2016-02-23 Thread Stuart Brady
On Wed, Feb 17, 2016 at 12:29:34AM +, Stuart Brady wrote: > > - should __array_size (b) be an integer constant (size_t)2, or should it > > be non-constant (size_t)2 because the argument is a VLA (albeit a VLA > > whose top-level dimension is an integer constant expressi

Re: [RFC] [PATCH] Add __array_size keyword

2016-02-16 Thread Stuart Brady
ntroduced when fixing this, I would rather just get it right. > On Tue, 16 Feb 2016, Stuart Brady wrote: > > If I use __array_size in an enumeration, this works fine, rather than > > giving me "error: enumerator value for ‘foo’ is not an integer constant". > > I am n

Re: [RFC] [PATCH] Add __array_size keyword

2016-02-16 Thread Stuart Brady
ot; I do get the expected warning, so I think that covers this case. Is this right? If I use __array_size in an enumeration, this works fine, rather than giving me "error: enumerator value for ‘foo’ is not an integer constant". I am not sure if this is not also a valid test. -- Many thanks, Stuart Brady

Re: [RFC] [PATCH] Add __array_size keyword

2016-02-16 Thread Stuart Brady
On Mon, Feb 15, 2016 at 03:51:43PM +, Stuart Brady wrote: > On Mon, Feb 15, 2016 at 03:05:36PM +0100, Marek Polacek wrote: > > On Sat, Feb 13, 2016 at 03:16:49AM +0000, Stuart Brady wrote: > > > For a hypothetical change to the C standard itself, I think one might

Re: [RFC] [PATCH] Add __array_size keyword

2016-02-16 Thread Stuart Brady
On Mon, Feb 15, 2016 at 11:11:54PM +, Joseph Myers wrote: > On Sat, 13 Feb 2016, Stuart Brady wrote: > > > So in other words, adapting all of the sizeof tests would be appropriate, > > and sizeof tests for non-array types would change from expected passes to > > expe

Re: [RFC] [PATCH] Add __array_size keyword

2016-02-15 Thread Stuart Brady
On Mon, Feb 15, 2016 at 03:05:36PM +0100, Marek Polacek wrote: > On Sat, Feb 13, 2016 at 03:16:49AM +0000, Stuart Brady wrote: > > I will look into submitting a PR for this properly soon, but will not > > mind if someone wants to take this task upon themselves instead, > >

Re: [RFC] [PATCH] Add __array_size keyword

2016-02-12 Thread Stuart Brady
matter of dealing with this for C++, Objective C and also Objective C++, but I'd very much prefer to deal with C first, as that seems the most straightforward, as is fundamental to the others. -- Thanks, Stuart Brady

[RFC] [PATCH] Add __array_size keyword

2016-02-11 Thread Stuart Brady
If anyone could help guide me through this process I would be very grateful. My patch, if deemed desirable, may be large enough to require copyright assignment, in which case I would very much appreciate some help in dealing with this. -- Stuart Brady [0] My own blog post with the macro that I