Welcome to the Builder Academy

Question Compile Warnings with Set Variables.

More
01 Nov 2015 21:28 #5526 by Liko
Hello,

I am getting a bunch of strange warnings with set variables.

Example:

qedit.c line 59:
Code:
qedit.c:59:9: warning: variable ‘buf3’ set but not used [-Wunused-but-set-variab le] char *buf3; ^
^ This is repeated about 10 - 15 times with different variables.
Code:
char *buf3;

Now you scroll down a few lines and you see buf3 is defined and used:
Code:
buf3 = two_arguments(argument, buf1, buf2);

Now I don't know if they just want me to actually use buf3 in the code. I could use buf1 instead. What do you guys think?

Randian(0.0.0)
Owner/Developer

Please Log in or Create an account to join the conversation.

More
02 Nov 2015 21:44 #5528 by thomas
it's "set" but not "used" (ie. read). So, if you never read it, just remove the var and keep the two_arguments() call:
Code:
two_arguments(argument, buf1, buf2);

Please Log in or Create an account to join the conversation.

Time to create page: 0.201 seconds