#122820 - sgeos - Thu Mar 22, 2007 5:22 pm
If unused parameters are used, no warnings are issued. There are no adverse effects, as far as I can see. Does anybody know if adverse effects could ever occur? (On a different compiler with a different definition of UNUSED, perhaps?)
-Brendan
Code: |
#include <stdio.h>
#define UNUSED __attribute__((unused)) unsigned int f(UNUSED unsigned int pU, UNUSED signed int pS) { return pU + pS; } int main(void) { unsigned int a = 100; signed int b = -1; printf("> %d\n", f(a, b)); return f(a, b); } |
Code: |
USER@Stardust ~/c/test
$ gcc -O0 -Wall -Wextra -ansi -pedantic -Werror -Wconversion -o test test.c USER@Stardust ~/c/test $ ./test.exe > 99 USER@Stardust ~/c/test $ gcc -O3 -Wall -Wextra -ansi -pedantic -Werror -Wconversion -o test test.c USER@Stardust ~/c/test $ ./test.exe > 99 USER@Stardust ~/c/test $ |
-Brendan