PDA

View Full Version : [C]why this warning?



rschirin
February 12th, 2012, 11:29 PM
can someone explain me this?



ro@beethoven:~/Scrivania/o_fine$ gcc -c -Wall proxy_invio.c
proxy_invio.c: In function ‘main’:
proxy_invio.c:1028:26: warning: variable ‘len2’ set but not used [-Wunused-but-set-variable]

in proxy_invio.c


#define GETMHTTP "GET mhttp://"

main(){
int len2;
.
.
.
.
len2=strlen(GETMHTTP);
.
.
.

schauerlich
February 13th, 2012, 12:01 AM
Well, read the warning. You give 'len2' a value (the result of strlen()), but then never use the variable anywhere else. If you think you did use the variable somewhere, then chances are you made a typo.