hpux man page for xtnew

Query: xtnew

OS: hpux

Section: 3

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
xtmalloc(3) - x11r4
xtnewstring(3) - x11r4
xtrealloc(3) - x11r4
xtnewstring(3) - suse
xtrealloc(3) - suse
Similar Topics in the Unix Linux Community
replacing multiple lines
Expermenting with Some Images in Amazon S3
How do you get gnus to work?
Ignore Testing Attachment Modal for Quick Reply