[rescue] Cooling (Long Message, sorry)

Big Endian bigendian at mac.com
Tue Apr 16 22:22:57 CDT 2002


This isn't right:
>
>float * test() {
>   int x = 3;
>   int y = 4;
>
>   float f[x][y];
>
>   return (float *)f;
>
>}

Ok... I'm suprised this even compiles.

>Meaning, that f isn't a new memory location each time, which is a major
>problem since instead of test() here, I was writing a function that constructs
>a matrix that then needs to persist past the creation of the next 
>one, and also
>gets passed to third party libraries.

Ok... so if x and y are fixed size (say 4x4 matrix):

typedef float[4][4] fmat4x4;

fmat4x4 newmat = malloc(sizeof(fmat4x4)); //sorry... my C is showing

daniel
-- 
-----------------------------------------------------------------
"Fragile. Do not drop." -- Posted on a Boeing 757.



More information about the rescue mailing list