View Issue Details

IDProjectCategoryView StatusLast Update
00014701003.1(2016/18)/Issue7+TC2System Interfacespublic2024-06-11 09:08
Reporterdennisw Assigned To 
PrioritynormalSeverityObjectionTypeError
Status ClosedResolutionAccepted 
NameDennis Wölfing
Organization
User Reference
Sectiontdelete
Page Number2138-2139
Line Number68532-68556
Interp Status---
Final Accepted Text
Summary0001470: tdelete example is incorrect
DescriptionThe 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 ActionOn page 2138 line 68532 change
tdelete((void *)elementptr, &root, delete_root);
to
tdelete((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;
}
Tagstc3-2008

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2021-05-07 13:22 dennisw New Issue
2021-05-07 13:22 dennisw Name => Dennis Wölfing
2021-05-07 13:22 dennisw Section => tdelete
2021-05-07 13:22 dennisw Page Number => 2138-2139
2021-05-07 13:22 dennisw Line Number => 68532-68556
2021-11-18 17:00 Don Cragun Interp Status => ---
2021-11-18 17:00 Don Cragun Status New => Resolved
2021-11-18 17:00 Don Cragun Resolution Open => Accepted
2021-11-18 17:00 Don Cragun Tag Attached: tc3-2008
2021-12-13 15:12 geoffclare Status Resolved => Applied
2024-06-11 09:08 agadmin Status Applied => Closed