RE: [PATCH 1/2] add typeof_member() macro

From: David Laight
Date: Thu May 30 2019 - 07:41:24 EST


From: Alexey Dobriyan
> Sent: 29 May 2019 20:07
>
> Add typeof_member() macro so that types can be exctracted without
> introducing dummy variables.
>
> Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
> ---
>
> include/linux/kernel.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -88,6 +88,8 @@
> */
> #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
>
> +#define typeof_member(T, m) typeof(((T*)0)->m)

Should probably be 't' (not 'T') and upper case ?

Hmmm.... the #define is longer that what it expands to ...

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)