dynamically-allocated memory is uninitialized

paulf@free.fr paulf@free.fr
Mon Nov 14 14:30:00 GMT 2016


----- Original Message -----
> On 12/11/2016 08:04, nick wrote:
> 
> > On 2016-11-12 01:37 AM, Andrew Pinski wrote:
> >
> >> Anyways I think the problem is you assume
> >> new Record*[N]; will NULL out the array.  It does not.

PMJI.

If you want value initialization then you need to write

new Record*[N]();

otherwise you get default initialization which for a builtin type like a pointer means not initialized.

A+
Paul



More information about the Gcc-help mailing list