Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
50cdd869
Commit
50cdd869
authored
Jun 20, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed outdated part of the string.rst.
parent
21771276
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
34 deletions
+0
-34
docs/examples/tutorial/string/const_char.pyx
docs/examples/tutorial/string/const_char.pyx
+0
-6
docs/examples/tutorial/string/const_left_out.pyx
docs/examples/tutorial/string/const_left_out.pyx
+0
-2
docs/src/tutorial/strings.rst
docs/src/tutorial/strings.rst
+0
-26
No files found.
docs/examples/tutorial/string/const_char.pyx
deleted
100644 → 0
View file @
21771276
from
libc.string
cimport
const_char
,
const_uchar
cdef
extern
from
"someheader.h"
:
ctypedef
const_char
specialChar
int
process_string
(
const_char
*
s
)
const_uchar
*
look_up_cached_string
(
const_uchar
*
key
)
docs/examples/tutorial/string/const_left_out.pyx
deleted
100644 → 0
View file @
21771276
cdef
extern
from
"someheader.h"
:
int
process_string
(
char
*
s
)
# note: looses API information!
docs/src/tutorial/strings.rst
View file @
50cdd869
...
...
@@ -308,32 +308,6 @@ follows:
.. literalinclude:: ../../examples/tutorial/string/const.pyx
Previous versions required users to make the necessary declarations
at a textual level. If you need to support older Cython versions,
you can use the following approach.
In general, for arguments of external C functions, the ``const``
modifier does not matter and can be left out in the Cython
declaration (e.g. in a .pxd file). The C compiler will still do
the right thing, even if you declare this to Cython:
.. literalinclude:: ../../examples/tutorial/string/const_left_out.pyx
However, in most other situations, such as for return values and
variables that use specifically typedef-ed API types, it does matter
and the C compiler will emit at least a warning if used incorrectly.
To help with this, you can use the type definitions in the
``libc.string`` module, e.g.:
.. literalinclude:: ../../examples/tutorial/string/const_char.pyx
Note: even if the API only uses ``const`` for function arguments,
it is still preferable to properly declare them using these
provided :c:type:`const_char` types in order to simplify adaptations.
In Cython 0.18, these standard declarations have been changed to
use the correct ``const`` modifier, so your code will automatically
benefit from the new ``const`` support if it uses them.
Decoding bytes to text
----------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment