XtNew man page on HP-UX

Man page or keyword search:  
man Server   10987 pages
apropos Keyword Search (all sections)
Output format
HP-UX logo
[printable version]

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()
[top]

List of man pages available for HP-UX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net