pub unsafe extern "C" fn ruby_strtoul(
str_: *const c_char,
endptr: *mut *mut c_char,
base: c_int,
) -> c_ulongExpand description
Our own locale-insensitive version of strtoul(3). The conversion is done
as if the current locale is set to the “C” locale, no matter actual runtime
locale settings.
§@note This is needed because strtoul("i", 0, 36) would return zero
if it is locale sensitive and the current locale is tr_TR.
@param[in] str String of digits, optionally preceded with whitespaces
(ignored) and optionally + or - sign.
@param[out] endptr NULL, or an arbitrary pointer (overwritten on return).
@param[in] base 2 to 36 inclusive for each base, or special case
0 to detect the base from the contents of the string.
@return Converted integer, casted to unsigned long.
@post If endptr is not NULL, it is updated to point the first such
byte where conversion failed.
@note This function sets errno on failure.
- EINVAL: Passed base is out of range.
- ERANGE: Converted integer is out of range of long.
@warning As far as @shyouhei reads ISO/IEC 9899:2018 section 7.22.1.4, a
conforming strtoul implementation shall render ERANGE
whenever it finds the input string represents a negative
integer. Such thing can never be representable using unsigned long. However this implementation does not honour that
language. It just casts such negative value to the return
type, resulting a very big return value. This behaviour is at
least questionable. But we can no longer change that at this
point.
@note Not only does this function works under the “C” locale, but
also assumes its execution character set be what ruby calls an
ASCII-compatible character set; which does not include for
instance EBCDIC or UTF-16LE.
Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3