[Issue 18223] New: std.experimental.allocator uninitializedFillDefault could use memset
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Thu Jan 11 06:32:35 UTC 2018
    
    
  
https://issues.dlang.org/show_bug.cgi?id=18223
          Issue ID: 18223
           Summary: std.experimental.allocator uninitializedFillDefault
                    could use memset
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: n8sh.secondary at hotmail.com
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.
--
    
    
More information about the Digitalmars-d-bugs
mailing list