DIP60: @nogc attribute

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 17 15:18:02 PDT 2014


On Thu, 17 Apr 2014 18:08:43 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 4/17/2014 1:53 PM, Steven Schveighoffer wrote:
>> OK, you beat it out of me. I admit, when I said "Video  
>> processing/players with
>> network capability" I meant all FILE * I/O, and really nothing to do  
>> with video
>> processing or networking.
>
>
> I would expect that with a video processor, you aren't dealing with ARC  
> references inside the routine actually doing the work.

Obviously, if you are dealing with raw data, you are not using ARC while  
accessing the data. But you are using ARC to get a reference to that data.

For instance, you might see:

-(void)processVideoData:(NSData *)data
{
    unsigned char *vdata = data.data;
    // process vdata
    ...
}

During the entire processing, you never increment/decrement a reference  
count, because the caller will have passed data to you with an incremented  
count.

Just because ARC protects the data, doesn't mean you need to constantly  
and needlessly increment/decrement references. If you know the data won't  
go away while you are using it, you can just ignore the reference counting  
aspect.

-Steve


More information about the Digitalmars-d mailing list