On Thu, May 7, 2015 at 12:28 PM, Nikita Popov <nikita....@gmail.com> wrote: > On Mon, Jul 28, 2014 at 9:41 PM, Pierre Joye <pierre....@gmail.com> wrote: > >> >> On Jul 28, 2014 9:14 PM, "Dmitry Stogov" <dmi...@zend.com> wrote: >> > >> > I think opinions about readability are subjective. >> > >> > The real problem, that it'll break compatibility with old uncommon >> > compilers. >> > I'm not sure if new MSVC versions support it, but the one I use - does >> not. >> >> We are working with the vc team to test the c99 (c++11/14 as well) with >> many oss softwares, php included (non core ext). >> >> It could be possible to use c99 from a vc pov but not if we decide to >> release php-next next year. However with the yearly vc release, we could >> make it for Q4/2015. >> > Could you please provide an update on the current situation regarding C99 > support in MSVC? It seems that VS 2013 supports the most important C99 > features [1]. What's our current minimum required vc version? > > [1]: https://msdn.microsoft.com/en-us/library/hh409293.aspx
Today I explored what it would take to compile with -std=c90 and -std=c99. We're actually very close to being valid C99 – we just need to remove `uint` and `u_char` and define _XOPEN_SOURCE for glibc to expose some POSIX/UNIX stuff. Those same things have to be done for C90 compatibility and remove `//` style comments.c. The function strtoll doesn't exist until C90 and we use it; this means for C90 we have to use _XOPEN_SOURCE=600 for glibc to give it to us, but I am unsure how portable this is. Aside from strtoll we already use several features of C99 such as `inline`, `<stdint.h>`. In summary: I think we should move to C99 and compile with the -std=c99 flag. There are also features of C99 that would allow us to use zend_string* in internal functions instead of char*; this would be a big win for cleanup since user functions use zend_string* and there is forked logic because of this. This is, of course, dependent on the whether the compilers we intend to support will work with C99. I know that gcc, clang, icc and MS VS 2013 will all work with the basic features of C99 that we use now and expect to use in the future if we move to C99. Are there any other known compilers out there that we should check? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php