[Python-Dev] C99
Benjamin Peterson
benjamin at python.org
Sat Jun 4 14:47:43 EDT 2016
On Sat, Jun 4, 2016, at 11:32, Dino Viehland wrote:
>
>
> Martin wrote:
> > On 4 June 2016 at 06:11, Benjamin Peterson <benjamin at python.org> wrote:
> > > PEP 7 requires CPython to use C code conforming to the venerable C89
> > > standard. Traditionally, we've been stuck with C89 due to poor C
> > > support in MSVC. However, MSVC 2013 and 2015 implement the key
> > features of C99.
> > > C99 does not offer anything earth-shattering; here are the features I
> > > think we'd find most interesting:
> > > - Variable declarations can be on any line: removes possibly the most
> > > annoying limitation of C89.
> > > - Inline functions: We can make Py_DECREF and Py_INCREF inline
> > > functions rather than unpleasant macros.
> > > - C++-style line comments: Not an killer feature but commonly used.
> > > - Booleans
> >
> > My most-missed C99 feature would be designated initializers. Does MSVC
> > support them? It might allow you to do away with those giant pasted slot
> > tables, and just write the slots you need:
> >
> > PyTypeObject PyUnicodeIter_Type = {
> > PyVarObject_HEAD_INIT(&PyType_Type, 0)
> > .tp_name = "str_iterator",
> > .tp_basicsize = sizeof(unicodeiterobject),
> > .tp_dealloc = unicodeiter_dealloc,
> > .tp_getattro = PyObject_GenericGetAttr,
> > .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
> > .tp_traverse = unicodeiter_traverse,
> > .tp_iter = PyObject_SelfIter,
> > .tp_iternext = unicodeiter_next,
> > .tp_methods = unicodeiter_methods,
> > };
>
> I checked and VC++ does actually support this, and it looks like they
> support
> // comments as well. I don't think it fully supports all of the C99
> features - it appears
> They just cherry picked some stuff. The C99 standard library does appear
> to be fully
> supported with the exception of tgmath.h.
Are the C99 features VS++ supports documented anywhere? I couldn't find
any list.
More information about the Python-Dev
mailing list