On Wed, Jan 16, 2013 at 10:41 AM, Xin Li <delp...@delphij.net> wrote:

...

> Well, calling exit(3) actually do less on C++ (dtor's are not called
> in this case, if any local object is declared on stack, which is done
> when the code say 'return') but the difference is less on C.

Good to know -- thanks!

> In style(9) there is no explicit mention of using exit(3) but the
> example do use exit() instead of return() for main().

There's a fair amount of subtlety in style(9) ;)...

> By the way speaking for exit(3) preventing bugs on other OSes, do you
> have reference to these issue?  It sounds weird as I would see these
> as serious leakage which are normally fixed very quickly and we
> shouldn't be the first people who seeing them...

It wasn't really leakage, and it was only Windows (AFAICT) which is
its own special case. MSVC++ has copious warnings about using POSIX
APIs anyhow, so I figure it's a bad idea to depend on POSIX on Windows
:(...

There's a program that we have at $work that does dd equivalent logic
for writing/verifying files and what was happening is that whenever
the atexit handler was entered (basically whenever the terminating
condition was met) it would segfault on Windows. It might have been a
bug in terms of it entering the atexit(3) handler recursively (which
didn't occur on other OSes, e.g. FreeBSD, Linux, and OSX), but I
didn't take the time to track down the exact culprit (my goal was to
only stop the bleeding ;)..).

Thanks!
-Garrett
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to