* Re: Don't return void types from void functions. [not found] <200405260606.i4Q66dXB023475@hera.kernel.org> @ 2004-05-26 6:28 ` Jeff Garzik 2004-05-26 8:38 ` Denis Vlasenko 2004-05-28 22:20 ` H. Peter Anvin 0 siblings, 2 replies; 4+ messages in thread From: Jeff Garzik @ 2004-05-26 6:28 UTC (permalink / raw) To: Linus Torvalds; +Cc: Linux Kernel Mailing List 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? Jeff ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Don't return void types from void functions. 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 2004-05-28 22:20 ` H. Peter Anvin 1 sibling, 1 reply; 4+ messages in thread From: Denis Vlasenko @ 2004-05-26 8:38 UTC (permalink / raw) To: Jeff Garzik, Linus Torvalds; +Cc: Linux Kernel Mailing List 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; -- vda ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Don't return void types from void functions. 2004-05-26 8:38 ` Denis Vlasenko @ 2004-05-26 8:59 ` Paweł Sikora 0 siblings, 0 replies; 4+ messages in thread From: Paweł Sikora @ 2004-05-26 8:59 UTC (permalink / raw) To: Denis Vlasenko; +Cc: Linux Kernel Mailing List 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... ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Don't return void types from void functions. 2004-05-26 6:28 ` Don't return void types from void functions Jeff Garzik 2004-05-26 8:38 ` Denis Vlasenko @ 2004-05-28 22:20 ` H. Peter Anvin 1 sibling, 0 replies; 4+ messages in thread From: H. Peter Anvin @ 2004-05-28 22:20 UTC (permalink / raw) To: linux-kernel Followup to: <40B43913.7010207@pobox.com> By author: Jeff Garzik <jgarzik@pobox.com> In newsgroup: linux.dev.kernel > > 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? > What's wrong with it? Seriously... "return foo();" is the closest thing to a tailcall syntax as C/C++ has, and I've always considered it a Total Fscking Pain in The Ass[TM] that it somehow thinks functions returning void should have a different syntax than all other functions. -hpa ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-05-28 22:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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
2004-05-28 22:20 ` H. Peter Anvin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox