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
494f30b5
Commit
494f30b5
authored
Nov 14, 2008
by
Lisandro Dalcin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
array size could be expressions with known C compile-time values
parent
0e4a0434
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+0
-1
tests/run/carrays.pyx
tests/run/carrays.pyx
+21
-2
No files found.
Cython/Compiler/PyrexTypes.py
View file @
494f30b5
...
...
@@ -616,7 +616,6 @@ class CArrayType(CType):
is_array
=
1
def
__init__
(
self
,
base_type
,
size
):
assert
size
is
None
or
isinstance
(
size
,
int
),
repr
(
size
)
self
.
base_type
=
base_type
self
.
size
=
size
if
base_type
is
c_char_type
:
...
...
tests/run/carrays.pyx
View file @
494f30b5
__doc__
=
"""
>>> test()
>>> test
1
()
2
>>> test2()
0
>>> test3()
(2, 3)
"""
def
test
():
def
test
1
():
cdef
int
x
[
2
][
2
]
x
[
0
][
0
]
=
1
x
[
0
][
1
]
=
2
...
...
@@ -13,3 +17,18 @@ def test():
cdef
int
*
f
(
int
x
[
2
][
2
]):
return
x
[
0
]
def
test2
():
cdef
int
a1
[
5
]
cdef
int
a2
[
2
+
3
]
return
sizeof
(
a1
)
-
sizeof
(
a2
)
cdef
enum
:
MY_SIZE_A
=
2
MY_SIZE_B
=
3
def
test3
():
cdef
int
a
[
MY_SIZE_A
]
cdef
int
b
[
MY_SIZE_B
]
return
sizeof
(
a
)
/
sizeof
(
int
),
sizeof
(
b
)
/
sizeof
(
int
)
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