Viewing Issue Simple Details
[ Jump to Notes ]
|
[ Issue History ]
[ Print ]
|
ID |
Category |
Severity |
Type |
Date Submitted |
Last Update |
0001470 |
[1003.1(2016/18)/Issue7+TC2] System Interfaces |
Objection |
Error |
2021-05-07 13:22 |
2024-06-11 09:08 |
|
Reporter |
dennisw |
View Status |
public |
|
Assigned To |
|
Priority |
normal |
Resolution |
Accepted |
|
Status |
Closed |
|
|
|
|
Name |
Dennis Wölfing |
Organization |
|
User Reference |
|
Section |
tdelete |
Page Number |
2138-2139 |
Line Number |
68532-68556 |
Interp Status |
--- |
Final Accepted Text |
|
|
Summary |
0001470: tdelete example is incorrect |
Description |
The example says that a comparison function that always returns 0 can be used with tdelete to delete the root node of a binary search tree. However the standard does not actually guarantee this. It only says that some node will be deleted in this case but nothing says that this will be the root node.
Perhaps a balancing search tree algorithm might need to look at multiple nodes to ensure balancing and might then end up with deleting a non-root node since all nodes are considered to be equal. |
Desired Action |
On page 2138 line 68532 changetdelete((void *)elementptr, &root, delete_root); totdelete((void *)elementptr, &root, node_compare);
On pages 2138-2139 lines 68547-68556 delete/*
* This comparison routine can be used with tdelete()
* when explicitly deleting a root node, as no comparison
* is necessary.
*/
int
delete_root(const void *node1, const void *node2)
{
return 0;
} |
Tags |
tc3-2008 |
|
Attached Files |
|
|