logoalt Hacker News

voidUpdatetoday at 2:27 PM1 replyview on HN

I don't use C enough to know what the convention is for throwing an error when the function can return a number anyway. You'd have to ask someone else


Replies

zbentleytoday at 3:16 PM

In C, errors are usually indicated by a negative return value constant, crashing the program with abort, or setting the errno global (thread-local, but whatever) and expecting callers to check it. Sometimes multiple of those.

show 1 reply