Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
August 01, 2011 [Issue 6423] New: Garbage is returned from `void main()` | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6423 Summary: Garbage is returned from `void main()` Product: D Version: D1 & D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: verylonglogin.reg@gmail.com --- Comment #0 from Denis <verylonglogin.reg@gmail.com> 2011-08-01 05:06:43 PDT --- No `xor eax,eax` instruction added by dmd v1.069/v2.054 so the program returns garbage: void f(){} void main() { return f(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 27, 2013 [Issue 6423] Garbage is returned from `void main()` | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis | http://d.puremagic.com/issues/show_bug.cgi?id=6423 hsteoh@quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hsteoh@quickfur.ath.cx --- Comment #1 from hsteoh@quickfur.ath.cx 2013-08-27 08:16:42 PDT --- Still happens on git HEAD. I'm guessing perhaps the compiler got confused by returning a void function? I'm not sure code like this should be allowed, as it doesn't really make sense to be able to return void (via a return statement) -- nothing is being returned. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 27, 2013 [Issue 6423] Garbage is returned from `void main()` | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis | http://d.puremagic.com/issues/show_bug.cgi?id=6423 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #2 from bearophile_hugs@eml.cc 2013-08-27 08:20:10 PDT --- (In reply to comment #1) > I'm guessing perhaps the compiler got confused by returning a void function? I'm not sure code like this should be allowed, as it doesn't really make sense to be able to return void (via a return statement) -- nothing is being returned. Returning the result of a void function from a void function is accepted by design. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 27, 2013 [Issue 6423] Garbage is returned from `void main()` | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis | http://d.puremagic.com/issues/show_bug.cgi?id=6423 --- Comment #3 from hsteoh@quickfur.ath.cx 2013-08-27 09:42:38 PDT --- OK. Then it's purely just a wrong-code bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 27, 2013 [Issue 6423] Garbage is returned from `void main()` | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis | http://d.puremagic.com/issues/show_bug.cgi?id=6423 Iain Buclaw <ibuclaw@ubuntu.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ibuclaw@ubuntu.com --- Comment #4 from Iain Buclaw <ibuclaw@ubuntu.com> 2013-08-27 10:32:41 PDT --- (In reply to comment #2) > (In reply to comment #1) > > > I'm guessing perhaps the compiler got confused by returning a void function? I'm not sure code like this should be allowed, as it doesn't really make sense to be able to return void (via a return statement) -- nothing is being returned. > > Returning the result of a void function from a void function is accepted by design. Aye, but 'void main' is implicitly 'int main' - which is a special case in this instance. ;-) All other types of void returns are ok to return garbage. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation