[pypy-commit] cffi default: Update: document what are now real (minor) differences
arigo
noreply at buildbot.pypy.org
Tue Jun 26 11:55:51 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r525:b204e0b353cd
Date: 2012-06-26 11:55 +0200
http://bitbucket.org/cffi/cffi/changeset/b204e0b353cd/
Log: Update: document what are now real (minor) differences
diff --git a/doc/source/conf.py b/doc/source/conf.py
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -45,9 +45,9 @@
# built documents.
#
# The short X.Y version.
-version = '0.1'
+version = '0.2'
# The full version, including alpha/beta/rc tags.
-release = '0.1'
+release = '0.2'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/doc/source/index.rst b/doc/source/index.rst
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -337,6 +337,9 @@
unspecified length, as in "``int n[];``". The length is completed
by the C compiler.
+ .. versionadded:: 0.2
+ You can also specify it as ``int n[...];``.
+
* enums: in "``enum foo { A, B, C, ... };``" (with a trailing ``...``),
the enumerated values are not necessarily in order; the C compiler
will reorder them as needed and skip any unmentioned value. Like
@@ -394,8 +397,14 @@
pointer is done usually in C with the syntax ``*p``, which is not valid
Python, so instead you have to use the alternative syntax ``p[0]``
(which is also valid C). Additionally, the ``p.x`` and ``p->x``
-syntaxes in C both become ``p.x`` in Python. And instead of ``NULL``
-you use None.
+syntaxes in C both become ``p.x`` in Python.
+
+.. versionchanged:: 0.2
+ You will find ``ffi.NULL`` to use in the same places as the C ``NULL``.
+ Like the latter, it is actually defined to be ``ffi.cast("void *", 0)``.
+ In version 0.1, reading a NULL pointer used to return None;
+ now it returns a regular ``<cdata 'type *' NULL>``, which you can
+ check for e.g. by comparing it with ``ffi.NULL``.
There is no equivalent to the ``&`` operator in C (because it would not
fit nicely in the model, and it does not seem to be needed here).
@@ -425,9 +434,6 @@
>>> int(x)
42
-Similarly, this is the only way to get cdata objects for ``NULL``
-pointers, which are normally returned as None.
-
The initializer given as the optional second argument to ``ffi.new()``
can be mostly anything that you would use as an initializer for C code,
with lists or tuples instead of using the C syntax ``{ .., .., .. }``.
@@ -483,9 +489,8 @@
Variadic functions in C (which end with "``...``" as their last
argument) can be declared and called normally, with the exception that
-all the arguments passed in the variable part *must* be cdata objects,
-or possibly None for ``NULL``. This is because it would not be possible
-to guess, if you wrote this::
+all the arguments passed in the variable part *must* be cdata objects.
+This is because it would not be possible to guess, if you wrote this::
C.printf("hello, %d\n", 42)
More information about the pypy-commit
mailing list