-
-
Notifications
You must be signed in to change notification settings - Fork 606
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
add Placement New #17057
base: master
Are you sure you want to change the base?
add Placement New #17057
Conversation
Thanks for your pull request, @WalterBright! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#17057" |
29a5064
to
4db86a4
Compare
311f2cb
to
fd23a02
Compare
I got it to work for some basic cases. Next comes extending it to more complex ones. |
6456c9a
to
c1d3813
Compare
Placement new for structs seem to be working now! |
5f00e37
to
49f4a4c
Compare
If i'm reading this right, this will allow classes in betterC, using a kind of "allocator argument" like in $OTHER_LANGUAGES? Once upon a time I made my own internal fork of dmd that forced betterC on all D code but of course that didn't last long because it couldn't compile Phobos. (I should clarify, my usecase is making a kernel with betterC and so far I have had to use a hacky mixin and alias this in order to use inheritance. Also, will this unlock the door for interfaces?) |
16cdbd6
to
448abed
Compare
448abed
to
4087cfb
Compare
4087cfb
to
902a3a9
Compare
Placement works for class objects now! |
Did you tweak it to receive pointers as arguments? I've sent several emails recently and they've all gone silent; I'm wondering if they're getting lost. I also tried commenting on the code in GitHub. |
I haven't received emails about this. I will check my spam filter. I don't know why you cannot comment on github? I thought it was you who had gone silent! Glad that's not the case. I stewed about the placement expression as pointer for a while, and figured that making it essentially a Of course, placement new will always be unsafe, but at least we can prevent memory overruns with ref parameters. |
This implements Placement New, described in https://github.com/WalterBright/documents/blob/master/placementnew.md