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

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