gcc compiler warnings
Jonathan Saxton
jsaxton@appsecinc.com
Wed May 19 17:37:00 GMT 2010
Fumble fingers ... I meant
oldval = *ptr++;
-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Jonathan Saxton
Sent: Wednesday 19 May 2010 10:31
To: gcc-help
Subject: RE: gcc compiler warnings
Your compiler speaks the truth. You are not using the computed value.
What do you think
*ptr++;
actually does? It fetches the value stored at *ptr, then increments ptr. Where do you use the value?
As Andrew pointed out, perhaps you just wanted to increment the pointer without actually fetching the thing addressed by the pointer. If that is the case then you could just say:
oldval = ptr++; // Make local copy and scroll 1 ahead in ring buffer
-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of lee
Sent: Wednesday 19 May 2010 05:42
To: gcc-help
Subject: gcc compiler warnings
Hi simple qeuery ...
why does gcc give a warning: warning: value computed is not used
for... ptr++;
when the value is actually used!
code segment...
do {
oldval=*ptr;//make local copy
*ptr++; // scroll 1 ahead in ring buffer
if(isHeader(&oldval) && cntnumber > 1 ) //skip first header
word. check for header words inside data
break;
cntnumber += 1;
}while( !isTrailer( &oldval ) && cntnumber < totalchannels ); //
copy until the trailer
Regards
L
More information about the Gcc-help
mailing list