

Represents a return (or error) code returned by an XPCOM function.


This value is a strongly-typed enum used to represent a result code from an XPCOM function.

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, ethertank, kscarfone
最后编辑者: kscarfone,