Skip to content

Comment on Debian is switching back to GLIBCparent

Comments

"aborting is correct: unexpected truncation is always a logic bug"

How does a function knows what a programmer expects... A lot of use for those potentially truncating functions are for display purpose, where truncating is expected and not a logic bug...

A library function potentially exiting is mostly useless.

And as the GP said, for those cases that truncating is expected (or not a problem) then use strncpy_s.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.