News for hackers. Stuff that matters.
Re:Ask HN: What should a systems/low-level software engineer... by barrkel on Friday January 11, 2019 @08:57AM (#18883574)
C enum values are convertible from int; C++ enum values aren't. This is one of the biggest differences in fairly idiomatic C code and has been the case for a very long time (i.e. not dependent on newer C features not being in C++).

    #include <stdio.h>
    
    typedef enum EFoo {
        FOO_A = 1,
        FOO_B = 2
    } TFoo;
    
    int main()
    {
        TFoo foo = FOO_A | FOO_B;
        printf("foo = %d\n", foo);
    }
This compiles in C but not C++.
Re:Ask HN: What should a systems/low-level software engineer... by elteto on Friday January 11, 2019 @09:40AM (#18883828)
Re:Ask HN: What should a systems/low-level software engineer... by antaflos on Friday January 11, 2019 @10:33AM (#18884165)
That's not the same code, is it? GP's code does not seem to compile in C++: https://godbolt.org/z/5oAIYE

But it does in C: https://godbolt.org/z/zdTKiE

Re:Ask HN: What should a systems/low-level software engineer... by adrianN on Friday January 11, 2019 @10:38AM (#18884214)
Try creating a foo https://godbolt.org/z/AlHDhg