UCommon
Functions | Variables
cpr.h File Reference

Runtime functions. More...

#include <ucommon/platform.h>
#include <unistd.h>
Include dependency graph for cpr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 __attribute__ ((visibility("default"))) void cpr_runtime_error(const char *text) = NULL)
 Function to handle runtime errors. More...
 
template<typename T >
void freep (T **handle)
 
template<typename T >
T * newp (T **handle)
 

Variables

caddr_t address
 
caddr_t size_t known
 
void * mem2
 
const char * s2
 
size_t size
 
uint16_t v
 

Detailed Description

Runtime functions.

This includes common runtime library functions we may need portably.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition in file cpr.h.

Function Documentation

◆ __attribute__()

__attribute__ ( (visibility("default"))  ) const = NULL)

Function to handle runtime errors.

Portable swap code.

Portable memory placement helper function.

Portable memory allocation helper function.

When using the standard C library, runtime errors are handled by a simple abort. When using the stdc++ library with stdexcept, then std::runtime_error will be thrown.

Parameters
textof runtime error.

Handles out of heap error as a runtime error.

Parameters
sizeof memory block to allocate from heap.
Returns
memory address of allocated heap space.

This is used to process "placement" new operators where a new object is constructed over a pre-allocated area of memory. This handles invalid values through runtime error.

Parameters
sizeof object being constructed.
addresswhere the object is being placed.
knownsize of the location we are constructing the object in.
mem1to swap.
mem2to swap.
sizeof swap area.

◆ freep()

template<typename T >
void freep ( T **  handle)

Definition at line 181 of file cpr.h.

◆ newp()

template<typename T >
T * newp ( T **  handle)

Definition at line 176 of file cpr.h.

Variable Documentation

◆ address

caddr_t address

Definition at line 75 of file cpr.h.

◆ known

caddr_t size_t known

Definition at line 75 of file cpr.h.

◆ mem2

void* mem2

Definition at line 83 of file cpr.h.

◆ s2

const char * s2

Definition at line 148 of file cpr.h.

◆ size

const char size_t size

Definition at line 54 of file cpr.h.

◆ v

uint32_t v

Definition at line 167 of file cpr.h.