From: "Paweł Sikora" <pluto@pld-linux.org>
To: Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Don't return void types from void functions.
Date: Wed, 26 May 2004 10:59:10 +0200 [thread overview]
Message-ID: <200405261059.10930.pluto@pld-linux.org> (raw)
In-Reply-To: <200405261138.41008.vda@port.imtp.ilyichevsk.odessa.ua>
On Wednesday 26 of May 2004 10:38, Denis Vlasenko wrote:
> On Wednesday 26 May 2004 09:28, Jeff Garzik wrote:
> > Linux Kernel Mailing List wrote:
> > > diff -Nru a/drivers/net/tokenring/olympic.c
> > > b/drivers/net/tokenring/olympic.c ---
> > > a/drivers/net/tokenring/olympic.c 2004-05-25 23:06:49 -07:00 +++
> > > b/drivers/net/tokenring/olympic.c 2004-05-25 23:06:49 -07:00 @@ -1806,7
> > > +1806,7 @@
> > >
> > > static void __exit olympic_pci_cleanup(void)
> > > {
> > > - return pci_unregister_driver(&olympic_driver) ;
> > > + pci_unregister_driver(&olympic_driver) ;
> > > }
> >
> > Can we make gcc error out when it finds this?
>
> AFAIK new C++ standard allows this syntax.
>
> typedef int opaque;
>
> opaque f();
> opaque g() { return f(); }
>
> Now imagine we need to change
> -typedef int opaque;
> +typedef void opaque;
strict ISO C++ - yes,
strict ISO C - no.
# g++ -Wall -s -c void_ret.cpp -pedantic-errors
# gcc -Wall -s -c void_ret.c -pedantic-errors
void_ret.c: In function `g':
void_ret.c:4: error: `return' with a value, in function returning void
# gcc --version
gcc (GCC) 3.4.0 SSP (PLD Linux)
(...)
--
If you think of MS-DOS as mono, and Windows as stereo,
then Linux is Dolby Digital and all the music is free...
next prev parent reply other threads:[~2004-05-26 8:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200405260606.i4Q66dXB023475@hera.kernel.org>
2004-05-26 6:28 ` Don't return void types from void functions Jeff Garzik
2004-05-26 8:38 ` Denis Vlasenko
2004-05-26 8:59 ` Paweł Sikora [this message]
2004-05-28 22:20 ` H. Peter Anvin
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=200405261059.10930.pluto@pld-linux.org \
--to=pluto@pld-linux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vda@port.imtp.ilyichevsk.odessa.ua \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.