tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Do all -current compilers support C23 typed enum syntax?



On Fri, 4 Dec 2026 03:07:12 +0000
Taylor R Campbell <riastradh%NetBSD.org@localhost> wrote:

> The compiler, being very clever, sees that all enumerated values of
> enum cmd have been covered by the switch, so it helpfully deletes some
> code it can _prove_ is dead -- this part:
> 
> 	default:
> 		panic("unknown command");

What compiler does this?  From my reading of the standard this is not a
valid optimization, and in my testing gcc 16.2 does not do this at -O3.

--
Bobby


Home | Main Index | Thread Index | Old Index