How to check whether an empty array variable is null?
    Meta via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sat Oct 10 17:19:40 PDT 2015
    
    
  
On Sunday, 11 October 2015 at 00:18:54 UTC, Meta wrote:
> On Saturday, 10 October 2015 at 20:07:11 UTC, Jonathan M Davis 
> wrote:
>> It basically didn't bother to allocate an array on the heap, 
>> because you asked for one with a length of zero. 
>> Efficiency-wise, it makes no sense to allocate anything. You 
>> wouldn't be doing anything with the memory anyway. The only 
>> way that you're going to get an array of length 0 which 
>> doesn't have a null ptr is to slice an array down to a length 
>> of 0.
>>
>> - Jonathan M Davis
>
> Look at my second example.
Sorry, I thought you were responding to me.
    
    
More information about the Digitalmars-d-learn
mailing list