From 7aef75f43dc59e407b6b158f126959bc5811c642 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Tue, 19 Jan 2016 08:46:33 -0800 Subject: docs: Adjust as_int documentation to match implementation Also remove the description of behavior for trailing non-numeric characters. It's likely this will become a parse error in the future so better leave it as unspecified for now. Fixes #80. --- docs/manual.adoc | 4 ++-- docs/manual.html | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/manual.adoc b/docs/manual.adoc index 1d8d88a..56ebc07 100644 --- a/docs/manual.adoc +++ b/docs/manual.adoc @@ -934,9 +934,9 @@ long long xml_attribute::as_llong(long long def = 0) const; unsigned long long xml_attribute::as_ullong(unsigned long long def = 0) const; ---- -`as_int`, `as_uint`, `as_llong`, `as_ullong`, `as_double` and `as_float` convert attribute values to numbers. If attribute handle is null or attribute value is empty, `def` argument is returned (which is 0 by default). Otherwise, all leading whitespace characters are truncated, and the remaining string is parsed as an integer number in either decimal or hexadecimal form (applicable to `as_int`, `as_uint`, `as_llong` and `as_ullong`; hexadecimal format is used if the number has `0x` or `0X` prefix) or as a floating point number in either decimal or scientific form (`as_double` or `as_float`). Any extra characters are silently discarded, i.e. `as_int` will return `1` for string `"1abc"`. +`as_int`, `as_uint`, `as_llong`, `as_ullong`, `as_double` and `as_float` convert attribute values to numbers. If attribute handle is null `def` argument is returned (which is 0 by default). Otherwise, all leading whitespace characters are truncated, and the remaining string is parsed as an integer number in either decimal or hexadecimal form (applicable to `as_int`, `as_uint`, `as_llong` and `as_ullong`; hexadecimal format is used if the number has `0x` or `0X` prefix) or as a floating point number in either decimal or scientific form (`as_double` or `as_float`). -In case the input string contains a number that is out of the target numeric range, the result is undefined. +In case the input string contains a non-numeric character sequence or a number that is out of the target numeric range, the result is undefined. CAUTION: Number conversion functions depend on current C locale as set with `setlocale`, so may return unexpected results if the locale is different from `"C"`. diff --git a/docs/manual.html b/docs/manual.html index 7d3a87a..588fc1a 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -2105,10 +2105,10 @@ In many cases attribute values have types that are not strings - i.e. an attribu
-

as_int, as_uint, as_llong, as_ullong, as_double and as_float convert attribute values to numbers. If attribute handle is null or attribute value is empty, def argument is returned (which is 0 by default). Otherwise, all leading whitespace characters are truncated, and the remaining string is parsed as an integer number in either decimal or hexadecimal form (applicable to as_int, as_uint, as_llong and as_ullong; hexadecimal format is used if the number has 0x or 0X prefix) or as a floating point number in either decimal or scientific form (as_double or as_float). Any extra characters are silently discarded, i.e. as_int will return 1 for string "1abc".

+

as_int, as_uint, as_llong, as_ullong, as_double and as_float convert attribute values to numbers. If attribute handle is null def argument is returned (which is 0 by default). Otherwise, all leading whitespace characters are truncated, and the remaining string is parsed as an integer number in either decimal or hexadecimal form (applicable to as_int, as_uint, as_llong and as_ullong; hexadecimal format is used if the number has 0x or 0X prefix) or as a floating point number in either decimal or scientific form (as_double or as_float).

-

In case the input string contains a number that is out of the target numeric range, the result is undefined.

+

In case the input string contains a non-numeric character sequence or a number that is out of the target numeric range, the result is undefined.

@@ -5588,7 +5588,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in -- cgit v1.2.3