HP aC++/HP C Programmer's Guide (B3901-90036; A.06.26; September 2011)
Standard HP-UX Libraries and Header Files
HP-UX includes Several libraries that provide system services. You can access HP-UX
standard libraries by using header files that declare interfaces to those libraries. Refer
to the HP-UX Reference Manual for more information on library routines.
Location of Standard HP-UX Header Files
The standard HP-UX header files are located in /usr/include directory.
Using Header Files
To use a system library function, your HP aC++ source code must include the preprocessor
directive #include.
Example:
#include <filename.h>
where filename.h is the name of the C++ header file for the library function you want
to use. By enclosing filename.h in angle brackets, the HP aC++ compiler looks for
that particular header file in a standard location on the system. The compiler first looks
for header files in /opt/aCC/include directory. When no header files are found in
this directory, it searches /usr/includeUse header file options to modify the search
path..
Example
To use the getenv function that is in the standard system libraries (/usr/lib/libc.so
and /usr/lib/libc.a), specify:#include <stdlib.h>
because the external declaration of getenv is found in the header file /usr/include/
stdlib.h.
Allocation Policies for Containers
By default, allocating memory for STL containers is optimized for large applications.
Defaults have been tuned with speed efficiency as a primary concern. Space efficiency
was considered, but was secondary. Typically, therefore, memory is not allocated as
required, because this method is slow and inefficient. The containers obtain a block of
memory to hold many elements, and when this fills up, they get another block. The size
of the block depends on the element size. As a result, containers with only a few items
might end up allocating too much memory. This default behavior can be adjusted to
individual application needs.
For -AP Standard Library
The inline template function__rw_allocation_size can be explicitly specialized to
return the number of units for each type’s use in any container:
template <>
inline size_t __rw-allocation_size(bar*,size_t) {
230 Tools and Libraries