Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsresult

This article needs a technical review. How you can help.

The nsresult data type is a strongly-typed enum used to represent a value returned by an XPCOM function; these are typically error or status codes. For a list of defined result values, see Error codes returned by Mozilla APIs.

Note: On compilers that do not support strongly-typed enums (that is, compilers that don't support this feature of C++11), it falls back to being an unsigned 32-bit integer, as in past versions of Gecko.

Note: Prior to Gecko 19.0, nsresult was not strongly typed. As a result, it was possible for code to misuse it, such as returning an nsresult value from a function whose signature indicates it returns a boolean.

Because nsresult is strongly typed, code like the following will result in an error at compile time:

bool foo() {
  ...
  if (something) {
    return NS_ERROR_FAILURE;
  }
  ...
}

See also

Document Tags and Contributors

 Contributors to this page: Sheppy, kscarfone, ethertank
 Last updated by: Sheppy,