I have a variadic function that requires a double-NULL terminator.
Contrived, Simplified Example
void makeLine(char *name, ...) {
... accepts (x,y) coordinates until (0,0) is found,
... assume that any coordinate except (0,0) is legal
[i.e. (0,1) or (1,0) should not trigger a stop condition]
}
And I'd like to annotate it with __attribute ((sentinel))__ from gcc. But it seems that with the sentinel attribute, only one of the arguments can be required NULL as opposed to the desired sentinel(0,1) [last two required to be NULL].
Is there a way to ask gcc to enforce a double-NULL, or...
Given that the NULL can only be enforced for one of the two parameters, would you decorate this function with sentinel(0) or sentinel(1) and why? Which of the two positions would be more likely to catch bugs?