Skip to content

Comment on How to design an API function that creates somethingparent

Comments

If that char* is just a pointer into a static array which maps error codes to strings, I'd generally prefer to use a separate API to do that.

If it's a freshly allocated string that needs to be freed by the caller, well, that's one of many reasons I never enjoy my time with C.

AboutSource Built by g1lg1l

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