danibootstrap 13 Light Poster

Hi,

I observed a strange bug in VC6 and Visual Studio compiler. For one particular program I needed to declare a heap as u = new double[width * height]; where width = 640 and height = 480 and initialize all the values to 0. So I did memset(arru,0,640*480);. But to my surprise all the elements starting from u[1,61] are not zeros but the largest possible 64 bit double. I do not understand why this is happening. I tested the same in devcpp and it works fine but for some reason in the visual studio compilers the entire array is not being set to 0.

Could some one suggest as to how shall I solve this bug?This is important for the function of my code. A whole week I spent rewriting and tracing the code just to know that this much in dynamic heap declaration is causing the error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.