Documentation of D arrays

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Thu Jan 11 18:15:50 PST 2007


Sebastian Biallas wrote:
> Frits van Bommel wrote:
>> BCS wrote:
>>> bigger chunk of ram (this dosn't always happen). When the ~ and ~=
>>> operators are used, the GC always makes a copy.
>> ~ always makes a copy, but ~= only does so when necessary.
> 
> The first one is documented on the array page, but where is the
> documentation for ~=? Common knowledge by using D?

Not sure, but it should be in the spec somewhere...

> BtW: What exacly happens on:
> 
> a = b ~ c and a ~= b
> 
> ? Is this some build-in opCat? What are the semantics?

You can see it as a built-in opCat if you like.
What happens behind the scenes is that a function in the runtime is called.
The source to these functions is in dmd/src/phobos/internal/gc/gc.d if 
you really want to know exactly what they do... (_d_arraycat for ~, 
_d_arrayappend for ~= with array, _d_arrayappendc for ~= with single 
element)



More information about the Digitalmars-d mailing list