digitalmars.D.bugs - [Issue 6423] New: Garbage is returned from `void main()`
- d-bugmail puremagic.com (22/22) Aug 01 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6423
- d-bugmail puremagic.com (14/14) Aug 27 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6423
- d-bugmail puremagic.com (12/16) Aug 27 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6423
- d-bugmail puremagic.com (6/6) Aug 27 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6423
- d-bugmail puremagic.com (13/22) Aug 27 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6423
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 --- 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: -------
Aug 01 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6423 hsteoh quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hsteoh quickfur.ath.cx 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: -------
Aug 27 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6423 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.ccI'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: -------
Aug 27 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6423 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: -------
Aug 27 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6423 Iain Buclaw <ibuclaw ubuntu.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ibuclaw ubuntu.comAye, 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: -------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.
Aug 27 2013