[rescue] Cooling (Long Message, sorry)
Big Endian
bigendian at mac.com
Wed Apr 17 11:40:06 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.
Ok... *PLEASE* stop creating arrays with dimentions from variables.
You will fuck something up in the end. Either make them variable
sized float[][] and mess with the pointers, or make them fixed size
float[4][4].
daniel
--
-----------------------------------------------------------------
"Fragile. Do not drop." -- Posted on a Boeing 757.
More information about the rescue
mailing list