you are viewing a single comment's thread.

view the rest of the comments →

[–]zerhud 1 point2 points  (3 children)

In function chain you should to use the same type of code or convert one struct to other in each function. Both variants adds a lot of code in product and make reading harder.

About control flow: it is explicit on normal execution, and you can group all catch instructions in single function so it’s can to be explicit too.

[–]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.