Date: Fri, 13 Dec 1996 09:06:21 +0000 From: Bill Currie Subject: Re: Help ! To: jean-gael DOT gricourt AT snet DOT net Cc: djgpp AT delorie DOT com Reply-to: billc AT blackmagic DOT tait DOT co DOT nz Message-id: <32B11C8D.50EF@blackmagic.tait.co.nz> Organization: Tait Electronics NZ MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: QUOTED-PRINTABLE References: <32AF8925 DOT 7F68 AT snet DOT net> Jean-Ga=EBl GRICOURT wrote: >=20 > I can't figure out what's wrong with this, I got an error > (General protection fault) when I ran it. > I used DJGPP V2. >=20 [snip] > Myclass(int=3D0,int=3D0); > ~Myclass(); > }; >=20 > Myclass::Myclass(int i0,int j0) > { > int x; >=20 > i=3Di0;j=3Dj0; >=20 > *mem=3Dnew int[i];if(*mem=3D=3DNULL) { cout<<"no memory\n";exit(1)= ; } > for(x=3D0;x { > mem[x]=3Dnew int[j]; > if(mem[x]=3D=3DNULL) { cout<<"no memory\n";exit(1); } > } > } Malloc (and thus new) will not allocate 0 bytes, and will return a nu= ll pointer. Bill --=20 Leave others their otherness.