I'm using C++11. I realised I can do this and allocate on stack:
void someclasS::somefn(int naz) {
Ipp32f absValues[naz] // <--naz is dynamic
//.....more code
//.....
}
I thought I wasn’t supposed to be able to do this? Previously I was doing this:
std::unique_ptr<Ipp32f[]> absValues(new Ipp32f[naz]);
// when need to pass pointer have to use absValues.get()
To avoid having to delete the memory.
I would like very much to do the former if possible as it looks neater. But what are the consequences of doing so, if any?