Pure, Nothrow in Generic Programming

Walter Bright newshound1 at digitalmars.com
Fri Nov 27 01:36:45 PST 2009


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.



More information about the Digitalmars-d mailing list