xtnew(3) hpux man page | unix.com

Man Page: xtnew

Operating Environment: hpux

Section: 3

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
xtfree(3xt) - xfree86
xtcalloc(3) - x11r4
xtfree(3) - suse
xtmalloc(3) - suse
Similar Topics in the Unix Linux Community
Kill a particular process if it's over an hour hold
Expermenting with Some Images in Amazon S3
How do you get gnus to work?
Ignore Testing Attachment Modal for Quick Reply