[rescue] Cooling (Long Message, sorry)

Joshua D Boyd jdboyd at cs.millersville.edu
Wed Apr 17 11:30:52 CDT 2002


On Tue, Apr 16, 2002 at 11:51:15PM -0400, Sridhar the POWERful wrote:

> float ** test()
> {
> 	int x = 3;
> 	int y = 4;
> 	float ** f;
> 
> 	f = new float[x][y]; // Not sure if this is the right syntax.
> 
> 	return f;
> }

test.cc: In function `float ** test()':
test.cc:9: assignment to `float **' from `float (*)[((y - 1) + 1)]'

is what I get when I try to compile that.

However, f = (float**)new float[x][y]; works.
Substituting you test function to my program returns:
134519160
134519216
jdboyd at cs ~ 43 >

So, it is getting new memory each time it runs.  Why in the world didn't I
try that previously.  That would fix things nicely.

-- 
Joshua D. Boyd



More information about the rescue mailing list