eCosTM Reference Manual
Prev | Chapter 19. Package: C Library | Next

# Component: Standard utility functions

#### Macro name

CYGPKG_LIBC_STDLIB

#### Type

Dummy

#### Description

Options associated with the standard utility functions in <stdlib.h>

## Option: Inline versions of <stdlib.h> functions

#### Macro name

CYGIMP_LIBC_STDLIB_INLINES

#### Type

Boolean

#### Description

This option chooses whether some of the particularly simple standard utility functions from <stdlib.h> are available as inline functions. This may improve performance, and as the functions are small, may even improve code size.

## Component: Random number generation

#### Macro name

CYGPKG_LIBC_RAND

#### Type

Dummy

#### Description

These options control the behavior of the functions rand(), srand() and rand_r()

### Option: Per-thread random seed

#### Macro name

CYGSEM_LIBC_PER_THREAD_RAND

#### Type

Boolean

#### Description

This option controls whether the pseudo-random number generation functions rand() and srand() have their state recorded on a per-thread basis rather than global. If this option is disabled, some per-thread space can be saved. Note there is also a POSIX-standard rand_r() function to achieve a similar effect with user support. Enabling this option will use one slot of kernel per-thread data. You should ensure you have enough slots configured for all your per-thread data.

### Option: Random number seed

#### Macro name

CYGNUM_LIBC_RAND_SEED

#### Type

Count

#### Description

This selects the initial random number seed for rand()"s pseudo-random number generator. For strict ISO standard compliance, this should be 1, as per section 7.10.2.2 of the standard.

### Option: Tracing level

#### Macro name

CYGNUM_LIBC_RAND_TRACE_LEVEL

#### Type

Count

#### Description

Trace verbosity level for debugging the rand(), srand() and rand_r() functions. Increase this value to get additional trace output.

### Option: Simplest implementation

#### Macro name

CYGIMP_LIBC_RAND_SIMPLEST

#### Type

Radio

#### Description

This provides a very simple implementation of rand() that does not perform well with randomness in the lower significant bits. However it is exceptionally fast. It uses the sample algorithm from the ISO C standard itself.

### Option: Simple implementation #1

#### Macro name

CYGIMP_LIBC_RAND_SIMPLE1

#### Type

Radio

#### Description

This provides a very simple implementation of rand() based on the simplest implementation above. However it does try to work around the lack of randomness in the lower significant bits, at the expense of a little speed.

### Option: Knuth implementation #1

#### Macro name

CYGIMP_LIBC_RAND_KNUTH1

#### Type

Radio

#### Description

This implements a slightly more complex algorithm published in Donald E. Knuth"s Art of Computer Programming Vol.2 section 3.6 (p.185 in the 3rd ed.). This produces better random numbers than the simplest approach but is slower.

## Component: Support for dynamic memory allocation

#### Macro name

CYGPKG_LIBC_MALLOC

#### Type

Boolean

#### Description

This enables support for dynamic memory allocation as supplied by the functions malloc(), free(), calloc() and realloc(). As these functions are often used, but can have quite an overhead, disabling them here can ensure they cannot even be used accidentally when static allocation is preferred.

### Option: Size of the dynamic memory pool in bytes

#### Macro name

CYGNUM_LIBC_MALLOC_MEMPOOL_SIZE

#### Type

Count

#### Description

At this stage, dynamic memory allocation by malloc() and calloc() must be from a fixed-size, contiguous memory pool. This option is the size of that pool, in bytes. Note that not all of this is available for programs to use - some is needed for internal information about memory regions, and some may be lost to ensure that memory allocation only returns memory aligned on word (or double word) boundaries - a very common architecture constraint.

### Option: Support for C++ delete operator

#### Macro name

CYGIMP_LIBC_MALLOC_CXX_DELETE_CALLS_FREE

#### Type

Boolean

#### Description

C++ new and delete operators can call the C library"s malloc() and free() implicitly. If this is what is required, enable this option. However, if enabled, the dynamic memory allocation code is always linked in to the application, even if it is not explicitly called and new/delete are not used. This increases code and data size needlessly.

## Option: Provides strtod() and atof()

#### Macro name

CYGFUN_LIBC_strtod

#### Type

Boolean

#### Description

This option allows use of the utility function strtod() (and consequently atof()) to convert from string to double precision floating point numbers. Disabling this option removes the dependency on the math library package.

## Option: bsearch() tracing level

#### Macro name

CYGNUM_LIBC_BSEARCH_TRACE_LEVEL

#### Type

Count

#### Description

Trace verbosity level for debugging the <stdlib.h> binary search function bsearch(). Increase this value to get additional trace output.

## Option: qsort() tracing level

#### Macro name

CYGNUM_LIBC_QSORT_TRACE_LEVEL

#### Type

Count

#### Description

Trace verbosity level for debugging the <stdlib.h> quicksort function qsort(). Increase this value to get additional trace output.

Prev | Home | Next
Option: Inline version of the longjmp() function | Up | Component: Standard Input/Output functions