Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


I'm a c++ programmer and finding it hard to be excited about things we added to the language 12 years ago.


As a sneering C++ programmer, why are you even reading / commenting on a new C standard? This is basically a "if you don't have anything nice to say, don't say it" situation.


Honestly, because there's very little c++ content here on HN and a relatively large amount of C content. Most of the C content is full of people saying "we don't need X from C++" but the reality is most of these things have significant uses


Neither of those statements really matches my experience with HN (high C to C++ content ratio, lots of comments rejecting advances first added to C++). I totally agree some of these things are very useful and I'm glad to see them formalized in C (even years later than C++).


The same goes for C programmers with a chip on their shoulder!

There is a downvote button.


I wouldn't speak too loudly on that high horse.

The HN Rust Gang will find you.


They're too busy looking for their vowels to reply here.

Joking aside, I've a healthy amount of respect for rust, and I hope that many of the ideas make their way into other language. The terseness, heavy use of macros, _insane_ compile times (and that's coming from someone who writes templates in c++), general assumption that you're on Linux from third party crates, and IDE support combine for something that just isn't usable for me just yet. Maybe in a few years!


As a D programmer, why haven't you caught up yet?


I write a reasonable amount of kotlin these days and it's night and day.


As a rust programmer... etc etc.


Clang has had it as an extension for a long time




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: