Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86143 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79284 invoked from network); 9 May 2015 04:10:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 May 2015 04:10:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.178 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.213.178 mail-ig0-f178.google.com Received: from [209.85.213.178] ([209.85.213.178:37987] helo=mail-ig0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/23-41461-EA88D455 for ; Sat, 09 May 2015 00:10:23 -0400 Received: by igbhj9 with SMTP id hj9so36670723igb.1 for ; Fri, 08 May 2015 21:10:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Gjka5LpNn2XWqGM50hi9bSCrZY0GVQf7tD9skH0KPYk=; b=LtrhTmi0gsRWK5llHc7J8LJPvXTiFUfO80cu/iXv05FmtK0ZqNYeZCCsEGNqyRBu3F XvG39HcXCU/yaCzthVLNz8J+M+143IDF3q9ivvF1GUN1+z0ySSC8pRpqOFQnEYZ2EyM5 PxVrhTS99esiOs+pFOBuJ+DCfekBs5Pc0ExinSMtRqHfHjQwwkPRzIATxU83IEwMb5Ca tRi8PIe9/7ohkCzJ7g5Pp/4CNnzKOl2sUL90VdW9Hr4OoodV8vhCP6gX38+eNUMBQ8TV 5r1DWIALVi4vzeZXYYTkFV3dcZHfQEhl1A58W8VUH1SieL0OPD6AlMMa+Kj/r3qDo+Js ZxNg== MIME-Version: 1.0 X-Received: by 10.42.79.197 with SMTP id s5mr1215180ick.85.1431144619586; Fri, 08 May 2015 21:10:19 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.79.98.67 with HTTP; Fri, 8 May 2015 21:10:19 -0700 (PDT) In-Reply-To: References: <71A78449-A62C-400D-A01F-5668930A7BED@ajf.me> <554BDC4B.2010808@gmx.de> Date: Fri, 8 May 2015 22:10:19 -0600 X-Google-Sender-Auth: Q4Akog4qZDfMUO5LRIk47DQRJ_Y Message-ID: To: Pierre Joye Cc: Christoph Becker , Nikita Popov , Andrea Faulds , Dmitry Stogov , Julien Pauli , Derick Rethans , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Thoughts on C version supported for PHP-Next From: levim@php.net (Levi Morrison) On Fri, May 8, 2015 at 7:13 AM, Levi Morrison wrote: > On Fri, May 8, 2015 at 5:01 AM, Pierre Joye wrote: >> On May 8, 2015 4:42 AM, "Christoph Becker" wrote: >>> >>> Nikita Popov wrote: >>> >>> > [...] What's our current minimum required vc version? >>> >>> As of PHP 5.5 at least VC11 (Visual Studio 2012) is required for Windows >>> builds. The currently available snapshots of master are also built with >>> VC11[1]. >> >> We are in the process of testing latest or better said the upcoming next >> version of VC. >> >> However it is a long process. We use a couple of libs to test c99 support. >> >> What could be amazingly helpful, not only for VC, is some sample codes >> using what we are most likely to use intensively from c99. It will allow is >> to valid them against various compilers as well as clearly define what we >> can support in the CS, all compilers we are likely to support for 7, >> including VC, ICC or older GCC. >> >> Cheers, > > I am quite sure we would use these features: > > - compound literals (this would allow for zend_string* at compile time) > - designated initializers > > I'll work on some code examples later today if someone hasn't beaten > me to it by then. Here is a self-contained example of designated initializers: struct Point { int x; int y; }; int main(void) { struct Point p = { .y = 2, .x = 1, }; return !(p.x == 1 && p.y == 2); } And here is compound literals: #include struct sstring { size_t len; char *val; }; static struct sstring str; int main(void) { str = (struct sstring) { sizeof("hello, world") - 1, "hello, world" }; return !(str.len == sizeof("hello, world") - 1); } I expect in some cases we may even use them together. This particular example doesn't really show why, but sometimes we have two uint32_t's in a row and initializing them with a name helps make the code more understandable: #include struct sstring { size_t len; char *val; }; static struct sstring str; int main(void) { str = (struct sstring) { .len = sizeof("hello, world") - 1, .val = "hello, world", }; return !(str.len == sizeof("hello, world") - 1); }