While we're on the topic - C++ doesn't do that by default, but since C++17 you can enable enforcing it on a case-by-case basis - you can mark functions, or even enums and structures, as [[nodiscard]], and then the compiler will issue a warning if you don't use the return value of that function (or whatever function that returns a class or enum marked as [[nodiscard]]).