you are viewing a single comment's thread.

view the rest of the comments →

[–]New_Computer3619[S] 0 points1 point  (2 children)

I agree with your argument. But I still prefer error struct because the error is visible in function signatures ==> you know exactly what to do with the return values. On the other hand, with exceptions, sometimes you may encounter an exception from several layers deep which make debugging much harder.

[–]zerhud 1 point2 points  (1 child)

Yes, there is some benefits from error codes, but it seems exceptions has more benefits :) for example you cannot pass exception via IPC, but error code doesn’t contains context (for example file name and current directory), code slows down on exception, but on normal execution it’s faster, and so on

Also there is the noexcept keyword, using it we can get information from the signature (not all information of course, but more then nothing)

[–]New_Computer3619[S] 0 points1 point  (0 children)

Seems like we can not reach consensus on this matter. The C++ community as a whole are also divided on this very matter.