Re: [dev] [st] [patch] misplaced parenthesis in LEN macro

From: Rob <>
Date: Wed, 23 Apr 2014 12:40:14 +0100

Martti K├╝hne, 22 April 2014 <>:
> On Sun, Apr 20, 2014 at 9:24 PM, Rob <> 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?

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