This is a discussion on Re: return or exit at end of main()? within the mailing.openbsd.tech forums, part of the OpenBSD category; --> Marc Espie wrote: >>not quite what i meant. consider the program below, then consider with >>exit instead of return. ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Marc Espie wrote: >>not quite what i meant. consider the program below, then consider with >>exit instead of return. >> >>#include <stdio.h> >> >>class hello { >>public: >> hello() { printf("hello\n"); } >> ~hello() { printf("goodbye\n"); } >>}; >> >>int >>main() >>{ >> hello h; >> >> return (0); >>} >> > > I don't have my C++ standard around, but I'm pretty sure there should > be no difference. Actually there is. With exit instead of return, h's destructor is not called. - Marc Balmer |