Initialise all newly created arrays in arrays.i library.
Affects C++ code only. Closes #440.
This commit is contained in:
parent
cd04b372a4
commit
1ba48ceb99
3 changed files with 7 additions and 3 deletions
|
|
@ -81,7 +81,7 @@ typedef struct {
|
|||
|
||||
#ifdef __cplusplus
|
||||
NAME(int nelements) {
|
||||
return new TYPE[nelements];
|
||||
return new TYPE[nelements]();
|
||||
}
|
||||
~NAME() {
|
||||
delete [] self;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
%{
|
||||
static TYPE *new_##NAME(int nelements) { %}
|
||||
#ifdef __cplusplus
|
||||
%{ return new TYPE[nelements]; %}
|
||||
%{ return new TYPE[nelements](); %}
|
||||
#else
|
||||
%{ return (TYPE *) calloc(nelements,sizeof(TYPE)); %}
|
||||
#endif
|
||||
|
|
@ -78,7 +78,7 @@ typedef struct {} NAME;
|
|||
%extend NAME {
|
||||
#ifdef __cplusplus
|
||||
NAME(int nelements) {
|
||||
return new TYPE[nelements];
|
||||
return new TYPE[nelements]();
|
||||
}
|
||||
~NAME() {
|
||||
delete [] self;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue