Path: csiph.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: "The long goodbye to C" by Eric Raymond Date: Fri, 17 Nov 2017 11:47:37 -0800 Organization: None to speak of Lines: 22 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="7bdb529bd75084c73bb3dbd08c9ca777"; logging-data="17607"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19b21+AErxdENB4YGjaI4qp" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:ZNpK7Ek2cd2L1T7tF2hdn2TR+Qs= sha1:IacxH4AcofazSIWC8n7qk6abxG0= Xref: csiph.com comp.lang.c:122878 BGB writes: [...] > the main problem with Duff's Device is that, to make it work, it would > require a deep search for case statements within other code blocks, and > to make the compiler be able to handle case statements found in places > other than directly inside a switch block. this would be a fairly > non-trivial piece of logic to add for a fairly rare edge case that could > probably be done instead using an explicit goto or similar. I don't know how difficult that would be, but all conforming C compilers do it. A case label can appear anywhere within a switch statement, whether the code is using Duff's Device or not. (I don't know of a case other than Duff's Device where that would be useful. That doesn't mean there are no such cases.) -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"