[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [leafnode-list] Compiler warnings (again)
> *(g++); /* let g point to next element of array */
> Unfortunately, gcc barfs on the *(g++); line with "warning: value
> computed is not used".
What you're telling it to do is, in effect,
g_orig = g;
g = g + 1;
"*" means "dereference pointer" to get a value or something to assign
to. You can use pointers like
... // set i, pi, *pi
i = *pi; // dereference pi's value and assign it to i
*pi = i; // assign i's value to what pi points to
is as sensible as
You're telling it to take the value and ... do nothing with it.
gcc is right.
If you just want to increment g without looking at or changing what it
points to, which is what the comment seems to indicate,
g = g + 1;
are all equivalent. I prefer method 2 because it's obvious from the
start of the line that I'm changing the value.
Tim McDaniel is tmcd@xxxxxxxx; if that fail,
tmcd@xxxxxxxxxx is my work account.
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list