Re: dynamically-allocated memory is uninitialized

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- 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



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux