Where to start with SafeD?
Mike Franklin
slavo5150 at yahoo.com
Wed Feb 13 22:57:21 UTC 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
More information about the Digitalmars-d-learn
mailing list