On Wed, Feb 16, 2022 at 01:07:37PM +0100, Laslo Hunhold wrote:
> @all: why not make a static compile-time-check on LENGTH(tags) and vary
> the type accordingly?
> 
> #if LENGTH(tags) < 8
>       typedef tag_bitmap uint_least8_t;
> #elif LENGTH(tags) < 16
>       typedef tag_bitmap uint_least16_t;
> #elif LENGTH(tags) < 32
>       typedef tag_bitmap uint_least32_t;
> #elif LENGTH(tags) < 64
>       typedef tag_bitmap uint_least64_t;
> #else
>       #error "tags-array too long"
> #endif

Hi Laslo,

I don't think this is possible, at least not with the LENGTH macro. The
pre-processor doesn't have access to `sizeof` operator.

- NRK

Reply via email to