== Quote from Walter Bright (newshou...@digitalmars.com)'s article > dsimcha wrote: > > I would say that @safe doesn't make much sense. What if you're > > implementing your > > comparison function using memcmp() or something else that involves a bunch > > of > > pointers? If you pass memcmp() invalid parameters, it can segfault, and > > would > > therefore have to be marked as unsafe, meaning that safe functions couldn't call it. > A safe function is only safe if the parameters passed to it are valid. > memcmp() cannot be safe as it does pointer arithmetic.
I think you misunderstood the argument. memcmp() could be @trusted if functions only need to be safe when passed valid parameters, though I don't necessarily agree that this makes sense. I was thinking memcmp() shouldn't even be marked @trusted because it's so easy to invoke undefined behavior by passing incorrect parameters. This would mean that, if opCmp() uses it, opCmp() couldn't be marked as @safe.