[D-runtime] dup attributes?

Fawzi Mohamed fawzi at gmx.ch
Fri Aug 6 03:11:13 PDT 2010


On 6-ago-10, at 01:15, Sean Kelly wrote:

> Concatenation doesn't preserve bit flags?  Like if I do this:
>
> mystr ~= "a" ~ "b";
>
> You're saying that it's possible for the bits set on mystr to be lost?
>
> On Aug 4, 2010, at 10:19 AM, Steve Schveighoffer wrote:
>
>> One more thing -- concatenation suffers from the same problem.   
>> This one might
>> be much harder to swallow since you may have to do N flag lookups.

well it is not so clear to me what the flags of a~b should be if the  
flags of a & b happens to be different.
I think that probably always using the default type flags from the  
typeinfo for the result is the way to go.

Append on the other end, a~=b should preserve the flags of a.
If the space is correctly reserved the realloc part should just be  
called log(N) times, so the cost is ok IMHO.

Dup should likewise preserve the flags.

Fawzi



More information about the D-runtime mailing list