Bug 18223 – std.experimental.allocator uninitializedFillDefault could use memset
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-01-11T06:32:35Z
Last change time
2018-03-31T04:58:32Z
Assigned to
No Owner
Creator
Nathan S.
Comments
Comment #0 by n8sh.secondary — 2018-01-11T06:32:35Z
Current function in std.experimental.allocator.package:
```
private T[] uninitializedFillDefault(T)(T[] array) nothrow
{
T t = T.init;
fillWithMemcpy(array, t);
return array;
}
```
When we can statically determine that the representation of T.init consists of nothing but zeroes we could instead use memset. char and wchar could also be special-cased.
Comment #1 by n8sh.secondary — 2018-02-05T20:27:22Z