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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
10e0f0c1
Commit
10e0f0c1
authored
Nov 20, 2014
by
nbruin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document implicit return value behaviour of cdef functions.
parent
7f7851f7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
docs/src/userguide/language_basics.rst
docs/src/userguide/language_basics.rst
+9
-1
No files found.
docs/src/userguide/language_basics.rst
View file @
10e0f0c1
...
...
@@ -160,6 +160,10 @@ with string attributes if they are to be used after the function returns.
C functions, on the other hand, can have parameters of any type, since they're
passed in directly using a normal C function call.
Functions declared using :keyword:`cdef`, like Python functions, will return a :keyword:`False`
value when execution leaves the function body without an explicit return value. This is in
contrast to C/C++, which leaves the return value undefined.
A more complete comparison of the pros and cons of these different method
types can be found at :ref:`early-binding-for-speed`.
...
...
@@ -216,7 +220,11 @@ returns ``-1``, an exception will be assumed to have occurred and will be
propagated.
When you declare an exception value for a function, you should never
explicitly return that value. If all possible return values are legal and you
explicitly or implicitly return that value. In particular, if the exceptional return value
is a ``False`` value, then you should ensure the function will never terminate via an implicit
or empty return.
If all possible return values are legal and you
can't reserve one entirely for signalling errors, you can use an alternative
form of exception value declaration::
...
...
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