From: David Miller <davem@davemloft.net>
To: harvey.harrison@gmail.com
Cc: akpm@linux-foundation.org, jeff@garzik.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 07/10] net: fix returning void-valued expression warnings
Date: Wed, 30 Apr 2008 15:08:32 -0700 (PDT) [thread overview]
Message-ID: <20080430.150832.107441339.davem@davemloft.net> (raw)
In-Reply-To: <1209593023.24729.117.camel@brick>
From: Harvey Harrison <harvey.harrison@gmail.com>
Date: Wed, 30 Apr 2008 15:03:43 -0700
> drivers/net/8390.c:37:2: warning: returning void-valued expression
> drivers/net/bnx2.c:1635:3: warning: returning void-valued expression
> drivers/net/xen-netfront.c:1806:2: warning: returning void-valued expression
> net/ipv4/tcp_hybla.c:105:3: warning: returning void-valued expression
> net/ipv4/tcp_vegas.c:171:3: warning: returning void-valued expression
> net/ipv4/tcp_veno.c:123:3: warning: returning void-valued expression
> net/sysctl_net.c:85:2: warning: returning void-valued expression
>
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
I wish this weren't marked with a warning, what spits this out,
sparse?
I know the kernel is written in C and not C++, but even Stroustrup
mentions this case explicitly in his book:
A void function cannot return a value. However, a call of a
void function doesn't yield a value, so a void function can
use a call of a void function as the expression in a return
statement.
And I see no reason why there's anything wrong with this construct.
next prev parent reply other threads:[~2008-04-30 22:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-30 22:03 Harvey Harrison
2008-04-30 22:08 ` David Miller [this message]
2008-04-30 22:20 ` Harvey Harrison
2008-04-30 22:21 ` David Miller
2008-05-01 3:19 ` Linus Torvalds
2008-04-30 23:31 ` Alan Cox
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=20080430.150832.107441339.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=akpm@linux-foundation.org \
--cc=harvey.harrison@gmail.com \
--cc=jeff@garzik.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®