resizeable arrays: T[new]

Tom S h3r3tic at remove.mat.uni.torun.pl
Mon Jun 4 04:57:31 PDT 2007


Lionello Lunesu wrote:
> Tom S wrote:
>> Daniel Keep wrote:
>>> The "new" inside the brackets just looks strange; a new what?
>>
>> I'm with you here ;)
>>
>>
>>> A few possible alternatives:
>>>
>>> T[new]    // Proposed
>>
>> Looks awkward, yeah. And it would produce false hits for anyone doing 
>> new-hunting (happens when you care about allocations, but prototype 
>> using 'new').
> 
> Huh. To me, that sounds like an argument *for* using [new], since any 
> array passed as [new] can cause an allocation in that function.

Not really, if you consider that it may be modified using realloc or 
some other wild schemes. And these are ok. I'd usually search for 'new', 
'~' and 'length' :P


> I like the [new] syntax :P

Nooooo! What have I done! *slaps himself with a trout*


-- 
Tomasz Stachowiak
http://h3.team0xf.com/
h3/h3r3tic on #D freenode



More information about the Digitalmars-d-announce mailing list