Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96854 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3006 invoked from network); 12 Nov 2016 14:23:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Nov 2016 14:23:49 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.15.19 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.15.19 mout.gmx.net Received: from [212.227.15.19] ([212.227.15.19:61462] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/C5-35596-4F527285 for ; Sat, 12 Nov 2016 09:23:48 -0500 Received: from [192.168.1.190] ([79.243.119.150]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LdYxu-1cVWIk0oeg-00imgH; Sat, 12 Nov 2016 15:23:44 +0100 To: Nikita Popov , Joe Watkins References: Cc: PHP internals Message-ID: <0d31e8b7-d39c-99b0-3cb9-5d6855a2d644@gmx.de> Date: Sat, 12 Nov 2016 15:23:49 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:gv6ZaslMzRfP35m7UI3INcNsfpzo0URVwqLW+yBn4opct09AD0d 6RYvHKBYh46fF80VeAK3u3Z1TbIR01ww9Rfm4U2I17x3FGPNEeaxX9QhuMtyHmkbHbZKwK8 rDDtgPvnnPygIxPozMhf3kZlZJ+73NmpM1h+qrvrsZpjEwc5YP5le/0vd9tdG/pBGo39Lqc UARrpww7fffjqTCI+saRQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:S2lfUEdL/PM=:/AA9OpuyAZBtge+tmz2Inm DfU4JBVmfT+QjbVB3w/0dptzst4cVPZj1GW4F8GmMsQXe12ydeDMZL+SxkcIc7hnJQehyW4oi tnYSzxTy21OjHymSBTGtq0U96SqHxKK1+P6SINs1n1g2iIe5EPUMPK6Jj9SOZkCRs8pVTFdM4 fiEjRcOuPnfThTigxsE81H9VIGlH3n9Bd/1DydY4RgVZAVJqGfoM6fgsU3KjEfiFDtkqM+STQ afzCBxpMZnDGAlxgIqV7PsAlOy8ohRep5ruadYFaYwpfLxHZeE+wOMYpwdWR4gAgClw0jCFkj QLIWe1iPkH9yNCQtAwN/ooZF19Uyc3ejSoTf67XRDxRAhPhcev+1MTB41HdsyF27+20+mmhov rW8Cv5z9A0Gau3F9ybDBd1uthgCG5kuzHHhWepOceN1A8ugzSzzZ0PndL0yCzNNbrK8iaaiC/ 3JSvspndqedpN184SUG9YMzS2eILvIcefqLgT2ugLuN1wTRAXumKSq0vZcL89shrBOZT7AAAC ZexACz2VBA8XY3oVoimbdTAEJXwdnq9zUrfuF71zAb3XW75AlaHWcwDrjgixSNn7mpo751jR9 MkbDjejpk1ZwijJ5QlfayPRcib/ibnNvOaxz0f18AZBp3AsckCgAuS7ky/SVZxFogYYpdN0yE IuPPDUbAdaZ+7oz3NWuSnaCF5MYb7O7WNhrT2b6uEICQ911xmL3EjsWnaZKSleDgy97iLgAE3 WGs5WikLpzMliSems+LSqqcVwy3iPhsKdYkhgpsKjpuUMRWb5XDisZEjeBaVgahZ43T8th1XL K2npdRH Subject: Re: [PHP-DEV] Re: C89 vs. C99 From: cmbecker69@gmx.de ("Christoph M. Becker") On 12.11.2016 at 14:59, Nikita Popov wrote: > There are two ways in which you can have code mixed with declarations. The > first one is within a single "basic block", like this: > > int a = ...; > b = ...; > int c = ...; > a = ...; > float d = ...; > // ... > > I can totally see how some many people might find this kind of code to be > objectionable. > > However, the use-case that I have in mind is different -- it's the case > where declarations **are** at the top of a block -- but its the top of a > basic block in terms of control flow, not a block in terms of C syntax. To > clarify what I mean by that: For a compiler (and arguably, a programmer), > the control flow of > > if (...) { > return; > } > > // Basic block starts here, but not C block > type var = ...; > > and of > > if (...) { > return; > } else { > // Basic block starts here, and C block > type var = ...; > } > > is the same. The declaration in both cases is at the top of a control-flow > block. It just doesn't happen to coincide with a syntactic C block. > > This is the case I'm interested in. > > Anyway, I'll just leave this gem from our codebase here: > https://github.com/php/php-src/blob/master/ext/standard/http_fopen_wrapper.c#L114 > (Some of those variables have 500 lines of code between declaration and > first use) In my humble opinion, inline declarations wouldn't make this code understandable – there are simply way too many variables and the function is way too large generally, and as such should be broken up. -- Christoph M. Becker