Issue of the Standard # S0054


There is no information about changes of memory location of the key for functions tsearch, tdelete, tfind, twalk.

Detailed Description

There are no clear requirements should the key always be located in the same node (or the same memory) or not. We propose to clarify this requirement to avoid the possible misunderstanding.

Problem location(s) in the standard

The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 Edition (SUS 3.0), System Interfaces,<br> description of functions tsearch(), tdelete(), tfind(), twalk().

Possible consequences

Possible incorrect behavior of applications that use tsearch(), tdelete(), tfind() or twalk() functions if developers estimates about possible changes of location in memory of tree nodes do not correspond to implementation behavior.

External manifestation of the problem

In tested implementation (RedHat Fedore Core 4.0, glibc 2.3.5), when deleting the root node, other node is copied to the previous root node location and the copied node is deleted.

Possible solutions

To avoid misunderstanding, it is proposed to clarify this place in the Standard (or Rationale) and state the possible relocation of nodes in memory. For example: “The position of a tree node in memory may change as a result of call to tsearch() or tdelete(). Application developers should know that node address returned by tfind() is not permanent and can be altered by calls to tsearch() or tdelete()”.


No references to this issue found.


POSIX aardvark,
Request Number 129