-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problems with RAII in C++ >= 11 #28
Comments
I've reproduced the same error on macOS with clang. I guess you also used the same systemc-build with quickthread, which could explain why there are still 4 objects left. |
I see 3 possible solutions:
|
The magic ability to jump without exception is implemented with assemble code, instead of using existing API, in quickthread cases. The concept of this, known as coroutine, has just been introduced into C++ for C++20(and C++20 defines a stackless coroutine). I wonder if the Systemc could be rewrite with standard solution if possible, but it seems cost too much. |
I'm more concerned with the fact that SystemC specification (which defines an API for implementers) has never been updated even to reflect C++11. The design of the API still stays on 90/03 level. |
I have a project in work where we manage some objects using fifo and because systemc API does not support move operations there is a problem with expensive and/or move-only objects.
Currently the issue is resolved by very ugly code like:
I would like to avoid pointer/lifetime issues yet I know that API is designed only with C++98/03 in mind. So I tried to use smart pointers which should keep any resources correctly managed.
I have made a reproducible example based on http://learnsystemc.com/basic/channel_fifo which showcases leaks - 4 objects remain even though I used only smart pointers:
execution log:
Using GCC Ubuntu 9.4.0-1ubuntu1~20.04.1
The text was updated successfully, but these errors were encountered: