[D-runtime] dup attributes?

Steve Schveighoffer schveiguy at yahoo.com
Wed Aug 4 05:32:38 PDT 2010


Currently, in the array runtime code, all appends and length settings copy the 
BlkAttr attributes from the existing block to the new block.  This is important 
if you set block attributes other than the default, or you are appending to a 
block which is currently typed differently than what it was when allocated.

However, the one function which does *not* do this is dup.  dup uses the 
typeinfo to determine the block attributes, including the NO_SCAN flag.

I think it should copy the attributes like all the other functions do.  However, 
there is one caveat to this.  Currently dup doesn't look up the block attributes 
of the existing data, because it doesn't have to.  So changing dup to copy the 
attributes would slow down dup a bit because in addition to allocating a new 
block, it must look up the flags for the old block.

What do you guys think?

-Steve



      


More information about the D-runtime mailing list