[pypy-commit] cffi add-float-dotdotdot: Document
arigo
noreply at buildbot.pypy.org
Fri Aug 28 11:00:32 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: add-float-dotdotdot
Changeset: r2261:f00569dace33
Date: 2015-08-28 11:01 +0200
http://bitbucket.org/cffi/cffi/changeset/f00569dace33/
Log: Document
diff --git a/doc/source/cdef.rst b/doc/source/cdef.rst
--- a/doc/source/cdef.rst
+++ b/doc/source/cdef.rst
@@ -394,6 +394,16 @@
``(u)int(8,16,32,64)_t`` in Python, but in the generated C code,
only ``foo_t`` is used.
+* *New in version 1.3:* floating-point types: "``typedef
+ float... foo_t;``" (or equivalently "``typedef double... foo_t;``")
+ declares ``foo_t`` as a-float-or-a-double; the compiler will figure
+ out which it is. Note that if the actual C type is even larger
+ (``long double`` on some platforms), then compilation will fail.
+ The problem is that the Python "float" type cannot be used to store
+ the extra precision. (Use the non-dot-dot-dot syntax ``typedef long
+ double foo_t;`` as usual, which returns values that are not Python
+ floats at all but cdata "long double" objects.)
+
* unknown types: the syntax "``typedef ... foo_t;``" declares the type
``foo_t`` as opaque. Useful mainly for when the API takes and returns
``foo_t *`` without you needing to look inside the ``foo_t``. Also
diff --git a/doc/source/whatsnew.rst b/doc/source/whatsnew.rst
--- a/doc/source/whatsnew.rst
+++ b/doc/source/whatsnew.rst
@@ -3,8 +3,12 @@
======================
-v1.2.2
-======
+v1.3
+====
+
+* Pull request #64: out-of-line API mode: we can now declare
+ floating-point types with ``typedef float... foo_t;``. This only
+ works if ``foo_t`` is a float or a double, not ``long double``.
* Issue #217: fix possible unaligned pointer manipulation, which crash
on some architectures (64-bit, non-x86).
More information about the pypy-commit
mailing list