Bug 13859 – Phobos uninitializedAlloc

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-12-12T10:46:31Z
Last change time
2024-12-01T16:23:17Z
Assigned to
No Owner
Creator
bearophile_hugs
Moved to GitHub: phobos#9649 →

Comments

Comment #0 by bearophile_hugs — 2014-12-12T10:46:31Z
I suggest to add to Phobos a simple function like this one: T* uninitializedAlloc(T)() pure nothrow @trusted { return cast(T*)GC.malloc(T.sizeof); } Such function can also take a little care for the presence of internal pointers to better tell the GC about their absence or presence.
Comment #1 by bearophile_hugs — 2014-12-23T10:43:01Z
I am not sure it can be @trusted. Andrei suggests: > There should be a minimallyInitializedAlloc, too. -- Andrei Here: http://forum.dlang.org/post/[email protected]
Comment #2 by code — 2014-12-25T11:03:19Z
What does minimally initialized mean again?
Comment #3 by bearophile_hugs — 2014-12-25T13:59:14Z
(In reply to Martin Nowak from comment #2) > What does minimally initialized mean again? Pointers and class references are initialized to null, recursively. The other parts are left uninitialized.
Comment #4 by robert.schadek — 2024-12-01T16:23:17Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9649 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB