Re: [dev] [st] [patch] misplaced parenthesis in LEN macro
Martti Kühne, 22 April 2014 <mysatyre_AT_gmail.com>:
> On Sun, Apr 20, 2014 at 9:24 PM, Rob <robpilling_AT_gmail.com> wrote:
>> Into the bikeshed I go...
>>
>> LEN(a + 2) doesn't mean anything anyway, as a's type decays.
>>
>> To do it properly there should be some kind of static assert in the
>> macro that the argument is of array type. But this is a small code base
>> and you'd expect that the code would be run and checked before
>> committing, which renders the assert pretty useless.
>>
>> I think it's fine as it is, in the original C way of doing things,
>> garbage in, garbage out, undefined behaviour etc etc.
>>
>> Rob
>>
>
>
> I may remind you there is the case where people make struct
> concatenations, just because they can. Arrays of concatenated structs.
> The cases where you don't even care when the preprocessor will append
> a pointer or a size_t to your type. You don't even want to know.
>
> So, no, the parentheses are not just needed for style.
>
> Which we require therefore.
I'm not sure I follow?
struct A bunch[10];
LEN(bunch) ?
Can you give an example?
Rob
Received on Wed Apr 23 2014 - 13:40:14 CEST
This archive was generated by hypermail 2.3.0
: Wed Apr 23 2014 - 13:48:06 CEST