Comment

Comment by quesomaster9000

Nobody else is admiring typed enumerations?

Particularly when using structs this removes a lot of ambiguity if you ignore the indirection to find out the underlying type of the enum (or encode it in the name hungarian style).

    enum D : uint8_t {
        A = 0,
        B = 1,
        C = 2
    }
    typedef struct {
        D f;
    } __attribute__((packed)) E;
    assert(sizeof(E)==1);
etc. could make grokking protocol declarations with enums less onerous and requiring one less level of indirection.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton