Why is accessing data in an uninitialised array undefined behaviour?
I ask because I was doing some benchmarking on
int**. My results were: http://stackoverflow.com/questions/20863478/class-using-stdvector-allocation-slower-than-pointer-allocation-by-a-lot
Now I'm being told if I use the raw array and try to access an index without initialising it first, it is undefined behaviour and that I must initialise it. The thing is, if I initialise it, it takes 43 seconds compared to 5 seconds. I'm asking here because I always get better answers here instead of stackoverflow and they are arguing over whether I'm allowed to do it or not.
Any ideas what I could do to keep the speed of uninitialising without breaking any rules?
Edited 2 Years Ago by triumphost