my ideas for array operations

Janice Caron caron800 at googlemail.com
Mon Oct 8 00:53:07 PDT 2007


On 10/8/07, dennis luehring <dl.soluz at gmx.net> wrote:
> only if the compiler don't understand whats going on
> who says that a compiler need to seperate each concatenate in a single
> operation? its the compilers job to use an efficent way

That's a very interesting question. I have absolutely no idea what the
answer is. Will the compiler optimize a~b~c~d~e~f~g~h into a single
allocation and some copying? I don't know. I hope so, but I suspect
not.

The existence of a cat() function would certainly encourage people to
write code in a concatenation-optimal way though.

(Note: I am /not/ suggesting that such a feature be added to D,
because the function is just too easy to write).



> do you think that a array slice works the same?

Of course not. Slicing doesn't involve /any/ allocations!



More information about the Digitalmars-d mailing list