Challenge 3: Why Result Is the Strongest of the Three Guarantees — Possible Solution ==================================================================== In C, a function's own signature (e.g. `int parse(const char *s)`) carries NO information at all about whether the operation can fail -- "failure" is communicated entirely out-of-band, through a convention (a special return value, or a separate errno check) that exists purely by agreement between the function's author and its caller, invisible to the compiler and to anyone just reading the function's declared type. Nothing forces a caller to check anything; the type system is completely blind to the possibility of failure. In C++, exceptions are a genuine improvement in ONE specific respect -- an uncaught exception terminates the program rather than silently continuing with a wrong value, which C's silently-ignorable return codes never guarantee. But per the chapter, WHICH exceptions a function might throw is still not part of its own type signature at all -- a function declared `int parse(const std::string &s)` gives a caller no indication, from the type alone, that it might throw std::invalid_argument, or anything else. A caller has no compile-time way to know a function might fail short of reading its documentation or its actual implementation. Rust's Result is different in kind, not just degree: the possibility of failure is BAKED DIRECTLY INTO THE FUNCTION'S OWN RETURN TYPE -- a function declared to return `Result` states, as part of its own type, unambiguously and permanently, "this operation can succeed with an i32 or fail with a ParseError." Because this is a real type (an enum with Ok and Err variants), Rust's own type system then FORCES the caller to deal with it -- code attempting to use a Result's inner value directly, without first handling both variants (via `?`, `.unwrap()`, or a `match`), simply doesn't compile. The compiler enforces engagement with the possibility of failure at every single call site, mechanically, rather than relying on the caller's own diligence or knowledge of undocumented exception types. This is why Result is the strongest: C's failure signal is invisible to both the type system and the compiler; C++'s exceptions are visible to the runtime (an uncaught one terminates) but still invisible to the type system and thus to the compiler's own checking; Rust's Result is visible to and ENFORCED BY the type system itself, closing the loop C++ leaves open. WHY THIS WORKS AS AN ANSWER ------------------------------ This traces the exact same question (is failure visible in, and enforced by, the type signature) across all three languages consistently, showing precisely where each one falls short of the next, rather than treating "Rust is safer" as a given without explaining the specific mechanism that makes it so.