Hacker News new | ask | show | jobs
by jstimpfle 2297 days ago
What I mean is this:

    > enum Foo { A, B, C };
    > Foo x = 1;
    test.cc:2:9: error: invalid conversion from ‘int’ to ‘Foo’ [-fpermissive]
     Foo x = 1;
I prefer not to use explicit casts because 1) using enum types is confusing to me 2) I frequently use values that are not in the enum - most often that's -1 as a way to indicate "missing". 3) I also like to iterate over all values from an enum using a plain for (int i = 0; i < NUM_FOOS; i++) without any fuss.

> As far as I know, MSVC just implements the C subset of C++.

There are things that work in MSVC C mode that do not work in C++ mode.