Armin Rigo avatar Armin Rigo committed c5c2477

Mention uintptr_t too

Comments (0)

Files changed (1)

doc/source/index.rst

     >>> int(x)
     42
 
-To cast a pointer to an int, cast it to ``intptr_t``, which is defined
-by C to be a large enough integer type::
+To cast a pointer to an int, cast it to ``intptr_t`` or ``uintptr_t``,
+which are defined by C to be large enough integer types (example on 32
+bits)::
 
-    >>> int(ffi.cast("intptr_t", pointer_cdata))
-    135812708
+    >>> int(ffi.cast("intptr_t", pointer_cdata))    # signed
+    -1340782304
+    >>> int(ffi.cast("uintptr_t", pointer_cdata))   # unsigned
+    2954184992L
 
 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,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.