News for hackers. Stuff that matters.
Re:no strpy either by AlexeyBrin on Tuesday December 30, 2025 @09:40AM (#46433741)
I guess the idea is that if the code does not crash at this line:

    DEBUGASSERT(slen < dsize);
it means it succeeded. Although some compilers will remove the assertions in release builds.

I would have preferred an explicit error code though.

Re:no strpy either by swinglock on Tuesday December 30, 2025 @11:02AM (#46434649)
assert() is always only compiled if NDEBUG is not defined. I hope DEBUGASSERT is just that too because it really sounds like it, even more so than assert does.

But regardless of whether the assert is compiled or not, its presence strongly signals that "in a C program strcpy should only be used when we have full control of both" is true for this new function as well.