Re: Antipattern in core.memory.GC.addRange?

2017-09-23 Thread Steven Schveighoffer via Digitalmars-d
On 9/23/17 1:55 AM, Petar Kirov [ZombineDev] wrote: How about adding a template wrapper function, along the lines of: static void addRange(T)(const T[] arr) {     addRange(arr.ptr, T.sizeof * arr.length, typeid(T)); } To core.memory.GC? It sounds good. But will it be accepted? Note, the

Re: Antipattern in core.memory.GC.addRange?

2017-09-23 Thread Steven Schveighoffer via Digitalmars-d
On 9/23/17 1:30 AM, safety0ff wrote: On Friday, 22 September 2017 at 21:29:10 UTC, Steven Schveighoffer wrote: GC.addRange has this signature: static nothrow @nogc void addRange(in void* p, size_t sz, const TypeInfo ti = null); I see a large problem with this. Let's say you malloc an array

Re: Antipattern in core.memory.GC.addRange?

2017-09-23 Thread Petar via Digitalmars-d
On Friday, 22 September 2017 at 21:29:10 UTC, Steven Schveighoffer wrote: GC.addRange has this signature: static nothrow @nogc void addRange(in void* p, size_t sz, const TypeInfo ti = null); I see a large problem with this. Let's say you malloc an array of struct pointers: struct Foo {

Re: Antipattern in core.memory.GC.addRange?

2017-09-22 Thread safety0ff via Digitalmars-d
On Friday, 22 September 2017 at 21:29:10 UTC, Steven Schveighoffer wrote: GC.addRange has this signature: static nothrow @nogc void addRange(in void* p, size_t sz, const TypeInfo ti = null); I see a large problem with this. Let's say you malloc an array of struct pointers: struct Foo {