December 30, 2011 Learn » Re: Bug or feature? std.c.stdlib.exit() breaks RAII | |||
|---|---|---|---|
| |||
Thanks, Jonathan, for your detailed answer. Ashish | |||
December 30, 2011 Learn » Re: Bug or feature? std.c.stdlib.exit() breaks RAII | |||
|---|---|---|---|
| |||
...stack won't be unwound properly, so RAII, scope statements, and finally blocks aren't... | |||
December 30, 2011 Learn » Re: Bug or feature? std.c.stdlib.exit() breaks RAII | |||
|---|---|---|---|
| |||
Ok, now there are two issues here: IMPLEMENTATION: Implementation of a safe_exit() without an... | |||
December 30, 2011 Learn » Re: Bug or feature? std.c.stdlib.exit() breaks RAII | |||
|---|---|---|---|
| |||
And how would it do that? The only way in the language to properly unwind... | |||
December 30, 2011 Learn » Re: Bug or feature? std.c.stdlib.exit() breaks RAII | |||
|---|---|---|---|
| |||
...following code shows that exit() breaks C++ RAII.
#include <iostream>
#include <cstdlib>
struct SafeExit {
~SafeExit... | |||
December 30, 2011 Learn » Re: Bug or feature? std.c.stdlib.exit() breaks RAII | |||
|---|---|---|---|
| |||
A D exit function would have to do essentially the same thing as throw an... | |||
December 29, 2011 Learn » Re: Bug or feature? std.c.stdlib.exit() breaks RAII | |||
|---|---|---|---|
| |||
Yeah, really. I'd been using the C exit() as well. Seems like a pretty... | |||
December 29, 2011 Learn » Re: Bug or feature? std.c.stdlib.exit() breaks RAII | |||
|---|---|---|---|
| |||
Could druntime hook up on the atexit function to run destructors and similar when the... | |||
December 29, 2011 Learn » Re: Bug or feature? std.c.stdlib.exit() breaks RAII | |||
|---|---|---|---|
| |||
Thanks, Andrej. That option had occurred to me, but I figured that shouldn't be... | |||
December 29, 2011 Learn » Re: Bug or feature? std.c.stdlib.exit() breaks RAII | |||
|---|---|---|---|
| |||
...main() to return your status code. Unlike exit(), throwing will take care of RAII stuff. | |||
Copyright © 1999-2021 by the D Language Foundation