SOMCalloc

From EDM2
Jump to: navigation, search

This function allocates sufficient memory for an array of objects of a specified size.

Syntax

size_t      num;
size_t      size;
somToken    rc;

rc = (*SomCalloc)(num, size);

Parameters

num(size_t) 
The number of objects for which space is to be allocated.
size(size_t) 
The size of the objects for which space to is to be allocated.

Return Code

rc(somToken) 
A pointer to the first byte of the allocated space.

Remarks

This function allocates an amount of memory equal to num*size (sufficient memory for an array of num objects of size size). This function has the same interface as the C calloc function. It performs the same basic function as calloc with some supplemental error checking. If an error occurs, the SOMError function is called. This routine is replaceable by changing the value of the global variable SOMCalloc.

Example Code

See function somVprintf.

Related

Data Structures
  • somToken (sombtype.h)
Functions