Path: csiph.com!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!85.12.16.69.MISMATCH!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.am4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx22.am4.POSTED!not-for-mail From: Spiros Bousbouras Newsgroups: comp.lang.c Subject: Re: An enhancement Message-ID: References: <531a5bb6-dc81-4eeb-9adf-1bf8eb310f65@googlegroups.com> In-Reply-To: <531a5bb6-dc81-4eeb-9adf-1bf8eb310f65@googlegroups.com> X-Organisation: Weyland-Yutani Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Lines: 50 X-Complaints-To: http://netreport.virginmedia.com NNTP-Posting-Date: Mon, 08 Oct 2018 23:37:54 UTC Organization: virginmedia.com Date: Mon, 08 Oct 2018 23:37:54 GMT X-Received-Bytes: 1932 X-Received-Body-CRC: 1221533706 Xref: csiph.com comp.lang.c:136449 On Mon, 8 Oct 2018 15:44:14 -0700 (PDT) David Kleinecke wrote: > I want to propose an enhancement: > > Add to C the statement type > DO identifier SEMICOLON > where the identifier is a label. The meaning is that > the statement just identified is replaced by the > statement following the label. [...] > The purpose of this enhancement is to enable > top-down coding in the sense Knuth wanted with > his literate programming. You can write code > like: > int foo (int x) { > if (x < 0) do trivial_case; > else if (x == 0) do easy_case; > else do usual_case; > return; > trivial_case: { > .... } > easy_case: { > .... } > usual_case: { > .... }} > which is generally easier to understand if you have > given as labels good descriptive phrases. You could achieve the same with macros : int foo (int x) { #define trivial_case { \ .... \ } #define easy_case { \ .... \ } #define usual_case { \ .... \ } if (x < 0) trivial_case else if (x == 0) easy_case else usual_case return 13 ; } Your code looks cleaner but I'm not sure the difference is worth adding the new syntax.