Anonymous | Login | 2025-01-22 17:12 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 | ||
0000688 | [1003.1(2013)/Issue7+TC1] System Interfaces | Objection | Error | 2013-05-03 16:08 | 2019-06-10 08:55 | ||
Reporter | geoffclare | View Status | public | ||||
Assigned To | |||||||
Priority | normal | Resolution | Accepted | ||||
Status | Closed | ||||||
Name | Geoff Clare | ||||||
Organization | The Open Group | ||||||
User Reference | |||||||
Section | realloc | ||||||
Page Number | 1769 | ||||||
Line Number | 56971 | ||||||
Interp Status | --- | ||||||
Final Accepted Text | |||||||
Summary | 0000688: realloc(NULL, 0) vs. malloc(0) | ||||||
Description |
The changes to the realloc() page in TC1 have introduced a conflict between the requirements for realloc(NULL, 0) and malloc(0). The realloc() page says: If ptr is a null pointer, realloc() shall be equivalent to malloc() for the specified size. However, when size is 0 all that is required of malloc() is "either a null pointer or a unique pointer that can be successfully passed to free() shall be returned". This does not match the new requirements for realloc(NULL, 0), where if it returns a null pointer, it must set errno. The intention of the realloc() changes was to allow applications to be able to determine whether the old pointer was freed. Since this doesn't apply when realloc() is passed a null pointer, I assume the new requirements should only apply to the non-null case. An alternative solution would be to change the equivalence statement to "If ptr is a null pointer [CX]and size is non-zero[/CX], realloc() shall be equivalent to malloc() for the specified size." |
||||||
Desired Action |
Change: A null pointer shall be returned [CX]and errno set to an implementation-defined value[/CX]. to: A null pointer shall be returned [CX]and, if ptr is not a null pointer, errno shall set to an implementation-defined value[/CX]. |
||||||
Tags | tc2-2008 | ||||||
Attached Files | |||||||
|
Relationships | |||||||||||||||||||
|
There are no notes attached to this issue. |
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |