←back to thread

327 points AareyBaba | 1 comments | | HN request time: 0.194s | source
Show context
dzonga ◴[] No.46184823[source]
I guess a bigger conversation could be had in regards to:

what leads to better code in terms of understandability & preventing errors

Exceptions (what almost every language does) or Error codes (like Golang)

are there folks here that choose to use error codes and forgo Exceptions completely ?

replies(1): >>46185096 #
jandrewrogers ◴[] No.46185096[source]
There isn't much of a conversation to be had here. For low-level systems code, exceptions introduce a bunch of issues and ugly edge cases. Error codes are cleaner, faster, and easier to reason about in this context. Pretty much all systems languages use error codes.

In C++, which supports both, exceptions are commonly disabled at compile-time for systems code. This is pretty idiomatic, I've never worked on a C++ code base that used exceptions. On the other hand, high-level non-systems C++ code may use exceptions.

replies(2): >>46186883 #>>46190650 #
1. dzonga ◴[] No.46186883[source]
thanks for the explanation.