Converting floats

Pages: 12
Hmmm. I'm lost now.

I added the following lines

1
2
static const unsigned int DATA_SIZE=width+1;
std::vector< std::vector<float> > diamond( DATA_SIZE, std::vector<float>(DATA_SIZE) );


It worked without any other code modification other then your suggestions!

Maybe the memory wasn't allocated correctly so using a vector fixed it???
Last edited on
Well you were putting 4 MB of memory on the stack... which on my machine caused a stack overflow runtime error.

Maybe your machine just silently let the stack wrap and overwrite itself? I find that a little hard to believe.


EDIT:

Only other difference I can think of is that the vector will fill memory with zeros, whereas a stack-allocated array will be uninitialized.
Last edited on
This requires some further investigation maybe on the compiler/linker side.
Topic archived. No new replies allowed.
Pages: 12