digitalmars.D.learn - Where to start with SafeD?
- solidstate1991 (9/9) Feb 13 2019 When I tried to apply to a position at Symmetry, I've got a
- Mike Franklin (10/16) Feb 13 2019 I don't understand your use case, but for me, I try not to escape
When I tried to apply to a position at Symmetry, I've got a criticism from Atila Neves that some of my code relied too much on memcpy, thus making it unsafe. After digging into std.array, I found some function that could possibly replace it to emulate writing in the middle of a file, but at least for VFile, I need some type agnostic solution. I don't think it would be an easy task to make CPUBLiT safe, unless I write a high-level wrapper for it that works with either array slices and/or on a per-image basis, but I don't have a need for such thing at the moment.
Feb 13 2019
On Wednesday, 13 February 2019 at 22:29:18 UTC, solidstate1991 wrote:When I tried to apply to a position at Symmetry, I've got a criticism from Atila Neves that some of my code relied too much on memcpy, thus making it unsafe. After digging into std.array, I found some function that could possibly replace it to emulate writing in the middle of a file, but at least for VFile, I need some type agnostic solution.I don't understand your use case, but for me, I try not to escape the type system. Instead of using void*, I recommend templating. That is the approach I took here: https://github.com/JinShil/memcpyD It still does explicit casts to prevent code bloat, which is still escaping the type system, but at least it avoids pointer arithmetic. I'm not sure if that's helpful, but regardless, there it is. Mike
Feb 13 2019