Messages in this thread | | | From | David Laight <> | Subject | RE: [PATCH v2 next] compiler.h: Move __is_constexpr() to compiler.h. | Date | Fri, 6 Oct 2023 15:51:06 +0000 |
| |
It can also be defined more portably as:
#define __is_constexpr(x) \ _Generic(0 ? (void *)((long)(x) * 0) : (int *)0, int *: 1, void *: 0)
Which doesn't rely on 'sizeof (void)' being valid.
But that is for another day.
There is also: #define is_pointer_type(type) __is_constexpr((type)1)
David
- Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
| |