3 ms·
Result types can be just as idiomatic in C++. The codebase I work in has exceptions disabled and uses absl::Status and absl::StatusOr[1] everywhere. [1] https:
by alexhutcheson 6y ago
Result types can be just as idiomatic in C++. The codebase I work in has exceptions disabled and uses absl::Status and absl::StatusOr[1] everywhere.
[1] https://abseil.io/docs/cpp/guides/status https://abseil.io/docs/cpp/guides/status
- mlindner 6y ago> Result types can be just as idiomatic in C++ If it `can be idiomatic` it means it's not currently idiomatic, and C++ isn't really heading in that direction. There's also a vast suite of C++ programmers out there to who it's very much not idiomatic and downright foreign. So if you're going to fight against how everyone else writes the language, it's best not to use the language.
- alexhutcheson 6y agoNo, by “can be idiomatic”, I meant “is already idiomatic in many codebases”. To name one prominent example among many, LLVM disables exceptions and requires that errors be returned as a value: https://llvm.org/docs/CodingStandards.html#do-not-use-rtti-or-exceptions https://llvm.org/docs/CodingStandards.html#do-not-use-rtti-o.... Disabling exceptions isn’t “fighting against how everyone else writes the language” - it’s pretty common and well-supported.