hpux man page for xtnew

Query: xtnew

OS: hpux

Section: 1

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

XtNew() 																   XtNew()

Name
  XtNew - allocate storage for one instance of a data type.

Synopsis
  type *XtNew(type)

Inputs
  type	    Specifies a  data type.  Note that this is not a variable.

Returns
  A pointer to sufficient allocated memory to store a variable of type type.

Description
  XtNew()  is  a  macro used to allocate storage for one instance of the data type type.  It is called with the datatype (a type, not a vari-
  able) and returns a pointer to enough allocated memory to hold that type.  The return value is correctly cast to type *.

  If there is insufficient memory, XtNew() calls XtErrorMsg() to display an error message and terminate the application.

Usage
  Memory allocated with XtNew() must be deallocated with XtFree().

  To allocate memory and copy an a string, use XtNewString().

Example
  XtNew() can be used as follows:

     typedef struct _node {
	 int value;
	 struct _node next;
     } Node;

     Node *n = XtNew(Node);

Background
  XtNew() is simply the following macro:

     #define XtNew(type) ((type *) XtMalloc((unsigned) sizeof(type)))

See Also
  XtMalloc(1), XtNewString(1).

Xt - Memory Allocation															   XtNew()
Related Man Pages
xtcalloc(3xt) - xfree86
xtmalloc(3xt) - xfree86
xtfree(3) - x11r4
xtmalloc(3) - x11r4
xtfree(3) - suse
Similar Topics in the Unix Linux Community
Thread browsing during search
Kill a particular process if it's over an hour hold
Expermenting with Some Images in Amazon S3
Awk multiple lines with 4th column on to a single line
How do you get gnus to work?