lkml.org 
[lkml]   [2008]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 07/10] net: fix returning void-valued expression warnings
From
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.


\
 
 \ /
  Last update: 2008-05-01 00:11    [W:0.061 / U:0.700 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site