Disable one unused variable warning
问题 How can I disable one warning in one place only? I have one variable which I temporarily don't use. Xcode shows me a warning about the "unused variable". I want to disable the warning, but for this variable only, not all warnings of this type. Is it possible without setting/getting this variable's value? 回答1: From GCC / Specifying Attributes of Variables (understood by Clang as well): int x __attribute__ ((unused)); or int y __attribute__((unused)) = initialValue ; 回答2: It's pretty simple: