www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/06/29/00:09:43

Date: Sun, 28 Jun 1992 22:24:27 -0500
From: Stuart M Lichtenthal <smlg1015 AT uxa DOT cso DOT uiuc DOT edu>
To: djgpp AT sun DOT soe DOT clarkson DOT edu

Dear djgpp users:

At the suggestion of one of you, I tried running my eispack
routines for matrices of dimension 255 and 256.  The program
works for 255 and crashes for 256, which is mighty suspicious.

For 256, the error is Exception 2 at eip=someaddress

The matrices are allocated using the following:

double **matrix1,**matrix2,**matrix3,**matrix4,**dmatrix();
matrix1=dmatrix(1,255,1,255);
.
.
.
matrix4=dmatrix(1,255,1,255);



where dmatrix is defined:
   
double **dmatrix(nrl,nrh,ncl,nch)
int nrl,nrh,ncl,nch;
{
int i;
float **m;

m=(double **)malloc((unsigned)(nrh-nrl+1)*sizeof(double*));
if(!m)nrerror("allocation failure");
m-=nrl;

for(i=nrl;i<=nrh;i++){
	m[i]=(double *)malloc((unsigned)(nch-ncl+1)*sizeof(double));
	if (!m[i])nrerror("allocation failure");
	m[i]-=ncl;
}
}

Is there some law about double pointers that I don't know about?
This type of allocation scheme has always worked for me in the past.

Stuart Lichtenthal
smlg1015 AT uxa DOT cso DOT uiuc DOT edu


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019