Thread overview
Does 'new' fill the memory.
Sep 30, 2005
Questiom
Sep 30, 2005
bobef
Oct 01, 2005
Ivan Senji
September 30, 2005
for example


char []a=new char[55];

Does the 'new' operator fill the array with 0 or can there be some crap in a[]? I could not find it from specification.

Does anybody know?


September 30, 2005
Questiom wrote:
> for example
> 
> 
> char []a=new char[55];
> 
> Does the 'new' operator fill the array with 0 or can there be some crap in a[]?
> I could not find it from specification.
> 
> Does anybody know?
> 
> 

Specs says, if I remember correctly, that all variables in D are automatically initialized (if they are not void initialized or whatever it was called).
October 01, 2005
"Questiom" <Questiom_member@pathlink.com> wrote in message news:dhk1ur$26bt$1@digitaldaemon.com...
> Does the 'new' operator fill the array with 0 or can there be some crap in
> a[]?
> I could not find it from specification.
>
> Does anybody know?

Yes, it is filled with the type's initializer (in this case 0).


October 01, 2005
Jarrett Billingsley wrote:
> "Questiom" <Questiom_member@pathlink.com> wrote in message news:dhk1ur$26bt$1@digitaldaemon.com...
> 
>>Does the 'new' operator fill the array with 0 or can there be some crap in a[]?
>>I could not find it from specification.
>>
>>Does anybody know?
> 
> 
> Yes, it is filled with the type's initializer (in this case 0). 
> 

Char is initialied with 0xFF not 0.
October 01, 2005
"Ivan Senji" <ivan.senji_REMOVE_@_THIS__gmail.com> wrote in message news:dhmaeu$l6g$1@digitaldaemon.com...
> Char is initialied with 0xFF not 0.

Crap.  Forgot about that.