JavaScript-1.5 Reference

INT_FITS_IN_JSVAL Macro

Summary

Determines if a specified value is a valid JS integer.

Syntax

INT_FITS_IN_JSVAL(i)

Description

Determines if a specified C integer value, i, lies within the minimum and maximum ranges allowed for a jsval integer. If the value is within range, it can become a valid JS integer, and INT_FITS_IN_JSVAL is true. Otherwise INT_FITS_IN_JSVAL is false.

Example

The following code snippet illustrates how a JavaScript variable, MyItem, is conditionally tested in an if statement to see if it is a legal integer value.
if (INT_FITS_IN_JSVAL(MyItem)) {
    . . .
}
else
    JS_ReportError(MyContext, "Integer out of range: %s",
       MyItem);

See Also

Groups [ Macro ]
Documents [ LXR ID Search ]
Entries [ INT_TO_JSVAL | JSVAL_TO_INT ]

This page was generated by APIDOC