string literals

Bill Baxter dnewsgroup at billbaxter.com
Wed Jan 23 21:17:10 PST 2008


downs wrote:
> Saaa wrote:
>> Can somebody please explain to me why char arrays are a special case of 
>> arrays?
>>
>> (when is this useful?) 
>>
>>
> 
> I don't understand what you mean with "special case". Character arrays (a.k.a. strings) are arrays just like the rest of 'em :)
> 
> The only difference is that they have an additional literal constructor in the form of "foo".
> 
>  --downs

That plus there is special casing in the compiler to support
    foreach(dchar x; some_string) {...}

--bb


More information about the Digitalmars-d-learn mailing list