From: Glynn Clements <glynn.clements@virgin.net>
To: linux-c-programming@vger.kernel.org
Subject: Re: value computed is not used ??
Date: Tue, 1 Jun 2004 04:25:58 +0100 [thread overview]
Message-ID: <16571.63302.688793.269892@cerise.nosuchdomain.co.uk> (raw)
In-Reply-To: <Pine.LNX.4.21.0406010333220.1813-100000@hestia>
J. wrote:
> When I try to compile the listed program, with gcc version 2.95.4 20011002
> and the command `gcc -Wall program.c -o program` It gives me a warning
> message like: warning: value computed is not used
>
> The program works perfectly fine, as far as I can judge the code isn't
> wrong in any way ? And the value is certainly used.. Unfortunatly this
> message shows to many times when I try to compile other code at my system.
>
> Can anyone explain to me what the sense behind that warning is ? And what
> to do about it ? e.g. what the ``better way`` of coding would be?
>
> #include <stdio.h>
>
> int main(void) {
> char *ptr = NULL;
> char str[] = "whats up";
>
> for(ptr = str; *ptr; *ptr++) {
for(ptr = str; *ptr; ptr++) {
There is no point in dereferencing "ptr++", which is why you get the
warning.
--
Glynn Clements <glynn.clements@virgin.net>
next prev parent reply other threads:[~2004-06-01 3:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-23 23:05 functions to determine dementions of console? ameer armaly
2004-05-24 2:09 ` Glynn Clements
2004-05-26 14:41 ` Christoph Bussenius
2004-05-30 19:12 ` J.
2004-05-30 20:35 ` Micha Feigin
2004-05-31 19:38 ` Christoph Bussenius
2004-06-01 1:41 ` value computed is not used ?? J.
2004-06-01 3:25 ` Glynn Clements [this message]
2004-06-01 7:30 ` Charlie Gordon
2004-06-01 16:08 ` Charlie Gordon
2004-06-01 21:58 ` Glynn Clements
2004-06-03 1:26 ` Micha Feigin
-- strict thread matches above, loose matches on Subject: below --
2004-06-01 17:34 Huber, George K RDECOM CERDEC STCD SRI
2004-06-01 19:09 ` Glynn Clements
2004-06-01 20:58 ` Charlie Gordon
2004-06-01 21:44 ` Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16571.63302.688793.269892@cerise.nosuchdomain.co.uk \
--to=glynn.clements@virgin.net \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).