Skip to content

Instantly share code, notes, and snippets.

@insom insom/martian.honey
Created Nov 16, 2016

Embed
What would you like to do?
Exploring (void)variable for supressing warnings
lappy:~ aaron$ cat a.C
int main(void) {
int a = 1 + 1;
}
lappy:~ aaron$ clang a.C -Wall
a.C:2:9: warning: unused variable 'a' [-Wunused-variable]
int a = 1 + 1;
^
1 warning generated.
lappy:~ aaron$ vim a.C
lappy:~ aaron$ cat aclang a.C -Wall
lappy:~ aaron$ cat a.C
int main(void) {
int a = 1 + 1;
a;
}
lappy:~ aaron$ clang a.C -Wall
a.C:3:5: warning: expression result unused [-Wunused-value]
a;
^
1 warning generated.
lappy:~ aaron$ vim a.C
lappy:~ aaron$ cat a.C
int main(void) {
int a = 1 + 1;
(void) a;
}
lappy:~ aaron$ clang a.C -Wall
lappy:~ aaron$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.