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

From: Alexey Dobriyan
Date: Thu May 30 2019 - 16:01:09 EST


On Thu, May 30, 2019 at 11:37:42AM +0000, David Laight wrote:
> From: Alexey Dobriyan

> > +#define typeof_member(T, m) typeof(((T*)0)->m)
>
> Should probably be 't' (not 'T') and upper case ?

T comes from C++ where they uppercase types in template arguments.
It makes sense as types stand out sligthly around lowercase identifiers.

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

It hides cast of 0 which is implementation detail :^)

Proper syntax would be

typeof(struct foo::bar)

but one can only dream.