diff options
Diffstat (limited to '')
-rw-r--r-- | include/stdlib.h | 36 | ||||
-rw-r--r-- | src/stdlib/atof.c | 9 | ||||
-rw-r--r-- | src/stdlib/atoi.c | 27 |
3 files changed, 40 insertions, 32 deletions
diff --git a/include/stdlib.h b/include/stdlib.h index 1244060..8d65597 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -137,10 +137,11 @@ char* relpath(const char*, const char*) * Convert a string to a floating-point value, * without checking for errors. * - * Note that, the behaviour is unspecified - * if the string contains anything else than - * digits, either a leading '-' (hyphen) - * or a leading plus, and at most one '.'. + * The string may being with an arbitrary number + * of whitespace characters. Convertion will end + * when a character is encountered that is not a + * decimal digit, and is not an absolutely leading + * '-' or '+', or the first '.'. * * @param string The string to convert. * @return The number encoded by the string. @@ -152,10 +153,11 @@ double atof(const char*) * Convert a string to an integer, * without checking for errors. * - * Note that, the behaviour is unspecified - * if the string contains anything else than - * digits and either a leading '-' (hyphen) - * or a leading plus. + * The string may being with an arbitrary number + * of whitespace characters. Convertion will end + * when a character is encountered that is not a + * decimal digit, and is not an absolutely leading + * '-' or '+'. * * @param string The string to convert. * @return The integer encoded by the string. @@ -167,10 +169,11 @@ int atoi(const char*) * Convert a string to an integer, * without checking for errors. * - * Note that, the behaviour is unspecified - * if the string contains anything else than - * digits and either a leading '-' (hyphen) - * or a leading plus. + * The string may being with an arbitrary number + * of whitespace characters. Convertion will end + * when a character is encountered that is not a + * decimal digit, and is not an absolutely leading + * '-' or '+'. * * @param string The string to convert. * @return The integer encoded by the string. @@ -182,10 +185,11 @@ long int atol(const char*) * Convert a string to an integer, * without checking for errors. * - * Note that, the behaviour is unspecified - * if the string contains anything else than - * digits and either a leading '-' (hyphen) - * or a leading plus. + * The string may being with an arbitrary number + * of whitespace characters. Convertion will end + * when a character is encountered that is not a + * decimal digit, and is not an absolutely leading + * '-' or '+'. * * @param string The string to convert. * @return The integer encoded by the string. diff --git a/src/stdlib/atof.c b/src/stdlib/atof.c index c5a4182..a4546b1 100644 --- a/src/stdlib/atof.c +++ b/src/stdlib/atof.c @@ -23,10 +23,11 @@ * Convert a string to a floating-point value, * without checking for errors. * - * Note that, the behaviour is unspecified - * if the string contains anything else than - * digits, either a leading '-' (hyphen) - * or a leading plus, and at most one '.'. + * The string may being with an arbitrary number + * of whitespace characters. Convertion will end + * when a character is encountered that is not a + * decimal digit, and is not an absolutely leading + * '-' or '+', or the first '.'. * * @param string The string to convert. * @return The number encoded by the string. diff --git a/src/stdlib/atoi.c b/src/stdlib/atoi.c index bbb87c3..9c45803 100644 --- a/src/stdlib/atoi.c +++ b/src/stdlib/atoi.c @@ -24,10 +24,11 @@ * Convert a string to an integer, * without checking for errors. * - * Note that, the behaviour is unspecified - * if the string contains anything else than - * digits and either a leading '-' (hyphen) - * or a leading plus. + * The string may being with an arbitrary number + * of whitespace characters. Convertion will end + * when a character is encountered that is not a + * decimal digit, and is not an absolutely leading + * '-' or '+'. * * @param string The string to convert. * @return The integer encoded by the string. @@ -42,10 +43,11 @@ int atoi(const char* string) * Convert a string to an integer, * without checking for errors. * - * Note that, the behaviour is unspecified - * if the string contains anything else than - * digits and either a leading '-' (hyphen) - * or a leading plus. + * The string may being with an arbitrary number + * of whitespace characters. Convertion will end + * when a character is encountered that is not a + * decimal digit, and is not an absolutely leading + * '-' or '+'. * * @param string The string to convert. * @return The integer encoded by the string. @@ -75,10 +77,11 @@ long int atol(const char* string) * Convert a string to an integer, * without checking for errors. * - * Note that, the behaviour is unspecified - * if the string contains anything else than - * digits and either a leading '-' (hyphen) - * or a leading plus. + * The string may being with an arbitrary number + * of whitespace characters. Convertion will end + * when a character is encountered that is not a + * decimal digit, and is not an absolutely leading + * '-' or '+'. * * @param string The string to convert. * @return The integer encoded by the string. |