Hi. I’m trying to trace down a bug in a (non-compiled class) I have doing helper work in a script. It’s causing bus errors/segmentation faults which I’m having a great deal of trouble tracing down. So, because I believe it to be memory related, I’ve implemented this in the constructor:
//Blank constructor no parameters
MDimArray::MDimArray() {
ar=new(nothrow) double[1];
if(ar == NULL) cout << "Memory allocation failed" << endl;
length=width=1;
}
//Constructor, required length and width
MDimArray::MDimArray(int len, int wid){
length=len; width=wid;
//Allocate space for a new single dimension array
ar=new(nothrow) double[len*wid];
for(int i=0; i<len; i++){
for(int j=0; j<wid; j++){
*(ar+wid*i+j)=0;
}
}
}
This almost immediately produces this error:
Error: Symbol nothrow is not defined in current scope MDimArray.C:50:
Error: memory allocation for double (nothrow)double size=8 pinc=1 FILE:/Users/chrispankow/Documents/ligowork/wbinsp/WBinspiral/src/./MDimArray.C LINE:50
Any ideas as to why the interpreter doesn’t recognize nothrow? Thanks in advance.