Initialise all newly created arrays in arrays.i library.

Affects C++ code only.

Closes #440.
This commit is contained in:
William S Fulton 2015-07-30 20:36:13 +01:00
commit 1ba48ceb99
3 changed files with 7 additions and 3 deletions

View file

@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 3.0.7 (in progress)
===========================
2015-07-30: wsfulton
Fix #440 - Initialise all newly created arrays when using %array_functions and %array_class
in the carrays.i library - bug is only relevant when using C++.
2015-07-29: wsfulton
[Python] Improve indentation warning and error messages for code in the following directives:

View file

@ -81,7 +81,7 @@ typedef struct {
#ifdef __cplusplus
NAME(int nelements) {
return new TYPE[nelements];
return new TYPE[nelements]();
}
~NAME() {
delete [] self;

View file

@ -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;