Your friend, the comma operator

C has had a comma operator for decades, the primary use of which is to separate function arguments.

By definition, the value of a comma separated statement is the right hand argument:

int i = j = 3, k = 4, l = 5;

sets i to 5, and is evaluated left to right. However, this is not the usage I have found for it.

Rather, I use it to bind statements that I fear some junior engineer is going to separate in the future – by mistake.

For instance:

[timer invalidate];
 timer = nil;

I could of course do:

{
    [timer invalidate];
     timer = nil;
}

but that looks like so much work for such a small thing. So instead, what I do is this:

[timer invalidate], timer = nil;

Its inconceivable that some developer in the future will separate those statements.

Thus, you can use the comma to tightly bind two or more statements together in a way that won’t get broken up by mistake.