Warning on a C++ Idiom
I make heavy use of the familiar C++ idiom that equates construction with resource allocation and destruction with resource release. For example:
- (void) drawSomething: (NSGraphicsContext*) context {
StDrawingState saved(context)
....
}
StDrawingState pushes the context in the constructor and pops it in the destructor. I can't forget to restore the state when I return.
AppCode out of the box thinks this is dubious, warning that "Local variable 'saved' is only assigned but never accessed." This is often a very handy warning, but here of course it's beside the point.
Can I silence the issue here without sacrificing the intent entirely? Can I silence the issue for all uses of StDrawingState?
Forgive a newbie question and probable duplicate; I've just getting my feet.
请先登录再写评论。
Mark, currently there is no option to suppress this warning for a specific class, though we probably should implement it.
Could you please file a feature request in the tracker and copy your description there?
Thanks