Re: Thoughts on C version supported for PHP-Next
| From: | Pierre Joye | Date: | Sat, 09 May 2015 04:23:13 +0000 |
| Subject: | Re: Thoughts on C version supported for PHP-Next | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86144@lists.php.net to get a copy of this message | ||
Hi!
Thanks!
Maybe we can create a repo on github to share them?
I can create one, yes I prefer github than PHP's git, much easier to
manage, issues, etc
Cheers,
Pierre
On May 9, 2015 11:10 AM, "Levi Morrison" <levim@php.net> wrote:
> On Fri, May 8, 2015 at 7:13 AM, Levi Morrison <levim@php.net> wrote:
> > On Fri, May 8, 2015 at 5:01 AM, Pierre Joye <pierre.php@gmail.com>
> wrote:
> >> On May 8, 2015 4:42 AM, "Christoph Becker" <cmbecker69@gmx.de> 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 <stddef.h>
>
> 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 <stddef.h>
>
> 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);
> }
>