Anonymous | Login | 2024-09-07 13:48 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||
ID | Category | Severity | Type | Date Submitted | Last Update | ||
0000700 | [1003.1(2008)/Issue 7] System Interfaces | Comment | Clarification Requested | 2013-05-19 18:12 | 2024-06-11 08:52 | ||
Reporter | fbauzac | View Status | public | ||||
Assigned To | ajosey | ||||||
Priority | normal | Resolution | Accepted As Marked | ||||
Status | Closed | ||||||
Name | Fabrice Bauzac | ||||||
Organization | |||||||
User Reference | |||||||
Section | strtoul | ||||||
Page Number | na | ||||||
Line Number | na | ||||||
Interp Status | --- | ||||||
Final Accepted Text | Note: 0006256 | ||||||
Summary | 0000700: Clarify strtoul's behaviour on strings representing negative numbers | ||||||
Description |
In which cases does strtoul (and other strtou* functions) fail with ERANGE? How is the range check performed? This ticket follows the discussion about strtoul on austin-group-l in May 2013. The RETURN VALUE section in http://pubs.opengroup.org/onlinepubs/009696799/functions/strtoul.html [^] says: If the correct value is outside the range of representable values, {ULONG_MAX} or {ULLONG_MAX} shall be returned and errno set to [ERANGE]. Some people understand this as "if the value I read (the correct value) is outside the [0, ULONG_MAX] range, then strtoul fails with ERANGE". However, it seems that many implementations do the following: 1. Read independently the optional sign and the subject [0-9]+ sequence 2. If the subject sequence fits in the unsigned long type, then store it in an unsigned long variable. Otherwise (outside the [0, ULONG_MAX] range), fail with ERANGE. 3. If there was a minus sign, then apply negation on the unsigned long variable as if it were a signed long. According to the discussion on the austin-group-l mailing list, it looks like this is what the POSIX standard (and the C standard) intend to specify. But it looks like it is not clear enough in the specification. |
||||||
Desired Action |
In section "RETURN VALUE", replace - If the correct value is outside the range of representable values with either of: + If the nonnegated value is outside the range of representable values or + If the unnegated value is outside the range of representable values or + If the value before potential negation is outside the range of representable values or + If the absolute value is outside the range of representable values or something similar |
||||||
Tags | applied_after_i8d3, c99, tc3-2008 | ||||||
Attached Files | |||||||
|
Notes | |
(0006150) nick (manager) 2023-02-16 16:41 edited on: 2023-02-16 16:45 |
During the 2022-02-13 - 2022-02-17 meeting, WG14 accepted paper https://www.open-std.org/jtc1/sc22/WG14/www/docs/n3107.pdf [^] (16 in favor, 0 against, 0 abstains). The C23 standard will contain the following change:
|
(0006256) geoffclare (manager) 2023-04-06 16:30 |
On 2018 edition page 2081 line 66795 section strtol(), and page 2277 line 72497 section wcstol(), change: the value resulting from the conversion shall be negated.to: the resulting value shall be the negative of the converted value. On 2018 edition page 2086 line 66909 section strtoul(), and page 2284 line 72661 section wcstoul(), change: the value resulting from the conversion shall be negated.to: the resulting value shall be the negative of the converted value; this action shall be performed in the return type. |
Issue History | |||
Date Modified | Username | Field | Change |
2013-05-19 18:12 | fbauzac | New Issue | |
2013-05-19 18:12 | fbauzac | Status | New => Under Review |
2013-05-19 18:12 | fbauzac | Assigned To | => ajosey |
2013-05-19 18:12 | fbauzac | Name | => Fabrice Bauzac |
2013-05-19 18:12 | fbauzac | Section | => strtoul |
2013-05-19 18:12 | fbauzac | Page Number | => na |
2013-05-19 18:12 | fbauzac | Line Number | => na |
2013-05-23 16:27 | msbrown | Project | 1003.1(2004)/Issue 6 => 1003.1(2008)/Issue 7 |
2014-04-03 16:22 | geoffclare | Tag Attached: c99 | |
2023-02-16 16:41 | nick | Note Added: 0006150 | |
2023-02-16 16:41 | nick | Note Added: 0006151 | |
2023-02-16 16:41 | nick | Note Deleted: 0006151 | |
2023-02-16 16:42 | nick | Note Edited: 0006150 | |
2023-02-16 16:44 | nick | Note Edited: 0006150 | |
2023-02-16 16:45 | nick | Note Edited: 0006150 | |
2023-04-06 16:30 | geoffclare | Note Added: 0006256 | |
2023-04-06 16:31 | geoffclare | Interp Status | => --- |
2023-04-06 16:31 | geoffclare | Final Accepted Text | => Note: 0006256 |
2023-04-06 16:31 | geoffclare | Status | Under Review => Resolved |
2023-04-06 16:31 | geoffclare | Resolution | Open => Accepted As Marked |
2023-04-06 16:32 | geoffclare | Tag Attached: tc3-2008 | |
2023-05-16 10:38 | geoffclare | Status | Resolved => Applied |
2023-05-16 10:39 | geoffclare | Tag Attached: applied_after_i8d3 | |
2024-06-11 08:52 | agadmin | Status | Applied => Closed |
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |