3 ms·
Compilers have (optional - it's kinda good practice to enable them though) warnings about things that are perfectly within spec and not undefined behavior, but
by ahartmetz 5y ago
Compilers have (optional - it's kinda good practice to enable them though) warnings about things that are perfectly within spec and not undefined behavior, but usually a bad idea.
A switch statement with a default: label is exhaustive. The warning is only about switches without a default. There is also a warning about exhaustive switches with a default. Makes sense - the first is apparently supposed to handle all the cases, but doesn't. The second is apparently supposed to handle some cases and not some others, but given that it's actually exhaustive, any enumerator added later should probably get its own label instead of falling under the previously unused default label.