Skip to content

Commit

Permalink
Initialise all newly created arrays in arrays.i library.
Browse files Browse the repository at this point in the history
Affects C++ code only.

Closes swig#440.
  • Loading branch information
wsfulton committed Jul 30, 2015
1 parent cd04b37 commit 1ba48ce
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGES.current
Original file line number Diff line number Diff line change
@@ -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:

2 changes: 1 addition & 1 deletion Lib/carrays.i
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ typedef struct {

#ifdef __cplusplus
NAME(int nelements) {
return new TYPE[nelements];
return new TYPE[nelements]();
}
~NAME() {
delete [] self;
4 changes: 2 additions & 2 deletions Lib/d/carrays.i
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 1ba48ce

Please sign in to comment.