Biggest problems w/ D - strings

Deewiant deewiant.doesnotlike.spam at gmail.com
Mon Aug 13 23:50:01 PDT 2007


Jarrett Billingsley wrote:
> "Oskar Linde" <oskar.lindeREM at OVEgmail.com> wrote in message 
> news:f9qcug$2sgj$1 at digitalmars.com...
>> C. Dunn wrote:
>>
>>> As for your follow-up, I thought that
>>>   char abc[32];
>>> would initialize abc to 32 zeroes automatically.  Am I wrong?
>> chars are initialized to 0xff
> 
> There are a few ways to get that initialized to 0 in the struct, tho:
> 
> 1) Just write the initializer in the struct.
> 
> struct S
> {
>     char[32] abc = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
>     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
> }
> 
> Kind of ugly, but straightforward.
> 

Ever since Issue 1268 was fixed in 1.017, you can just write:

char[32] abc = 0;

-- 
Remove ".doesnotlike.spam" from the mail address.



More information about the Digitalmars-d mailing list