On Fri, May 8, 2015 at 7:13 AM, Levi Morrison <le...@php.net> wrote: > On Fri, May 8, 2015 at 5:01 AM, Pierre Joye <pierre....@gmail.com> wrote: >> On May 8, 2015 4:42 AM, "Christoph Becker" <cmbecke...@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); } -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php