For the past few months, Aryeh has been doing a heroic work on making nsresult a strongly typed enum (aka, enum class). Strongly typed enums are a new feature in C++11 which enable declaring enums which are treated as real types by the compiler and go through similar type checking as other types. This morning I landed the final patches to bug 779473 on inbound and they seem to have stuck.

This will not affect you unless you write buggy code, with mistakes such as:

bool foo() {
  // ...
  if (somethingBadHappened)
    return NS_ERROR_FAILURE;
}

And the way it affects you is that the compiler will throw an error message for the invalid conversion. So, the compiler does more to detect bugs in the code, which is good!

This is currently enabled on all compilers which support strongly typed enums (recent clang, gcc >= 4.4, and Visual C++ 2012).

Cheers,
Ehsan
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to