Shore Programmer's Manual - 3 November 94


new \- create Shore object


#include <ShoreApp.h>

void *T::operator new(unsigned int size,
                      const char *path,
                      mode_t mode);

void *T::operator new(unsigned int size,
                      REF(Pool) pool);


These operators create new Shore objects of type T. In both cases, the size argument is supplied by the C++ compiler, not by the application. The first form creates a registered object named by path and with a mode given by mode (see umask(oc) for a description of how the actual mode is determined). The second form creates an anonymous object in the pool given by pool. If an error occurs during the creation of the object, then the currently installed error handler is called. An alternate interface for Shore object creation is REF(T)::new_persistent (see create(oc) ).

C++ specifies that operator new must return a "void *". However, applications should never assign the result of the Shore new operators to a "void *" or "T *" variable. Instead, they should REF(T)::operator= (see assign(oc) ) to assign it to variable of type REF(T).


The following example illustrates the use of operator new.
REF(Part) part;
REF(Pool) pool;

// create new registered part object
part = new("/home/ned/part", 0644) Part;

// create new anonymous part object in the given pool
pool = ...
part = new(pool) Part;
The first call to operator new creates a registered part object with pathname "/home/ned/part" and mode 0644. The second call creates an anonymous part object in the given pool.


This manual page applies to Version 0.1 of theShore software.


The Shore project is sponsored by the Advanced Research Project Agency, ARPA order number 018 (formerly 8230), monitored by the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518.


Copyright (c) 1994 Computer Sciences Department, University of Wisconsin -- Madison. All Rights Reserved.


assign(oc) , create(oc) , umask(oc) .