As I know when I allocates char[]
with size 200,000 and wanna init the whole buffer to zero. There's two ways for me:
const size_t SZ_LARGE_BUF = 200000;
char *largeBuf = new char[SZ_LARGE_BUF]; memset(blablabla);
char *largeBufWithInit = new char[SZ_LARGE_BUF]();
But the question is that when I run the 2nd code in linux, it's always get stuck, but the same code writing in windows VS2010 is ok. And the 1st code are both OK in Linux and Windows.
I wonder if there has any difference between memset
and init syntax
?