SYNOPSIS
#include <search.h>
void insque(void *element, void *pred);
void remque(void *element);
DESCRIPTION
The
The
The
If the queue is to be used as a linear list, invoking
insque(&element, NULL);
where element is the initial element of the queue, initializes the forward and backward pointers of element to null pointers.
If the queue is to be used as a circular list, the application must initialize the forward pointer and the backward pointer of the initial element of the queue to the element's own address.
PARAMETERS
- element
-
Is the element to be inserted into, or removed from, the queue.
- pred
-
Is the predecessor element that the specified element is to be inserted after.
RETURN VALUES
Nothing
CONFORMANCE
UNIX 98
MULTITHREAD SAFETY LEVEL
Unsafe.
PORTING ISSUES
The historical implementation of these functions described the arguments as being of type struct qelem * rather than as being of type void * as defined by UNIX 98. In those implementations, struct qelem was commonly defined in <search.h> as
struct qelem { struct qelem *q_forw; struct qelem *q_back; };
Applications using these functions, however, were never able to use this structure directly, since it provided no room for the actual data contained in the elements. Most applications defined structures that contained the two pointers as the initial elements and also provided space for, or pointers to, the object's data. Applications that used these functions to update more than one type of table also had the problem of specifying two or more different structures with the same name, if they literally used struct qelem as specified.
The implementations of these functions, however, were actually expecting a structure as defined in the description above. With C compilers that didn't provide function prototypes, applications used structures as specified and the compiler did what the applications expected.
If this method had been carried forward with an ANSI C compiler and the historical function prototype, most applications would have to be modified to cast pointers to the structure actually used to be pointers to struct qelem to avoid compilation warnings. By specifying void * as the argument type, applications won't need to change.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC MKS Toolkit 10.5 Documentation Build 40.