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
|
|
@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release.
|
||||||
Version 3.0.7 (in progress)
|
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
|
2015-07-29: wsfulton
|
||||||
[Python] Improve indentation warning and error messages for code in the following directives:
|
[Python] Improve indentation warning and error messages for code in the following directives:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ typedef struct {
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
NAME(int nelements) {
|
NAME(int nelements) {
|
||||||
return new TYPE[nelements];
|
return new TYPE[nelements]();
|
||||||
}
|
}
|
||||||
~NAME() {
|
~NAME() {
|
||||||
delete [] self;
|
delete [] self;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
%{
|
%{
|
||||||
static TYPE *new_##NAME(int nelements) { %}
|
static TYPE *new_##NAME(int nelements) { %}
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
%{ return new TYPE[nelements]; %}
|
%{ return new TYPE[nelements](); %}
|
||||||
#else
|
#else
|
||||||
%{ return (TYPE *) calloc(nelements,sizeof(TYPE)); %}
|
%{ return (TYPE *) calloc(nelements,sizeof(TYPE)); %}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -78,7 +78,7 @@ typedef struct {} NAME;
|
||||||
%extend NAME {
|
%extend NAME {
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
NAME(int nelements) {
|
NAME(int nelements) {
|
||||||
return new TYPE[nelements];
|
return new TYPE[nelements]();
|
||||||
}
|
}
|
||||||
~NAME() {
|
~NAME() {
|
||||||
delete [] self;
|
delete [] self;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue