From: Ævar Arnfjörð Bjarmason Date: Sun, 11 Nov 2018 20:10:17 GMT Subject: Re: [PATCH 03/10] fast-export: use value from correct enum Message-ID: <87va532x5i.fsf@evledraar.gmail.com> In-Reply-To: <20181111063636.GC30850@sigill.intra.peff.net> On Sun, Nov 11 2018, Jeff King wrote: > On Sat, Nov 10, 2018 at 10:23:05PM -0800, Elijah Newren wrote: > >> ABORT and ERROR happen to have the same value, but come from differnt >> enums. Use the one from the correct enum. > > Yikes. :) > > This is a good argument for naming these SIGNED_TAG_ABORT, etc. But this > is obviously an improvement in the meantime. In C enum values aren't the types of the enum, but I'd thought someone would have added a warning for this: #include enum { A, B } foo = A; enum { C, D } bar = C; int main(void) { switch (foo) { case C: puts("A"); break; case B: puts("B"); break; } } But none of the 4 C compilers (gcc, clang, suncc & xlc) I have warn about it. Good to know.