P99
Defines
Conversion of strings to integer types
C Programming facilities

Extensions of the strto and wcsto families of functions. More...

+ Collaboration diagram for Conversion of strings to integer types:

Defines

#define p99_strto(...)   P99_CALL_DEFARG(p99_strto, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strto.
#define p99_strtoc(...)   P99_CALL_DEFARG(p99_strtoc, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtoc.
#define p99_strtoh(...)   P99_CALL_DEFARG(p99_strtoh, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtoh.
#define p99_strtohh(...)   P99_CALL_DEFARG(p99_strtohh, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtohh.
#define p99_strtoi16(...)   P99_CALL_DEFARG(p99_strtoi16, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtoi16.
#define p99_strtoi32(...)   P99_CALL_DEFARG(p99_strtoi32, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtoi32.
#define p99_strtoi64(...)   P99_CALL_DEFARG(p99_strtoi64, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtoi64.
#define p99_strtoi8(...)   P99_CALL_DEFARG(p99_strtoi8, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtoi8.
#define p99_strtot(...)   P99_CALL_DEFARG(p99_strtot, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtot.
#define p99_strtou(...)   P99_CALL_DEFARG(p99_strtou, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtou.
#define p99_strtou16(...)   P99_CALL_DEFARG(p99_strtou16, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtou16.
#define p99_strtou32(...)   P99_CALL_DEFARG(p99_strtou32, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtou32.
#define p99_strtou64(...)   P99_CALL_DEFARG(p99_strtou64, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtou64.
#define p99_strtou8(...)   P99_CALL_DEFARG(p99_strtou8, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtou8.
#define p99_strtouh(...)   P99_CALL_DEFARG(p99_strtouh, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtouh.
#define p99_strtouhh(...)   P99_CALL_DEFARG(p99_strtouhh, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtouhh.
#define p99_strtouz(...)   P99_CALL_DEFARG(p99_strtouz, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtouz.
#define strto   p99_strto
#define strtoc   p99_strtoc
#define strtod(...)   P99_CALL_DEFARG(strtod, 2, __VA_ARGS__)
 Default arguments for C99 function strtod.
#define strtof(...)   P99_CALL_DEFARG(strtof, 2, __VA_ARGS__)
 Default arguments for C99 function strtof.
#define strtoh   p99_strtoh
#define strtohh   p99_strtohh
#define strtoi16   p99_strtoi16
#define strtoi32   p99_strtoi32
#define strtoi64   p99_strtoi64
#define strtoi8   p99_strtoi8
#define strtoimax(...)   P99_CALL_DEFARG(strtoimax, 3, __VA_ARGS__)
 Default arguments for C99 function strtoimax.
#define strtoj   p99_strtoj
#define strtol(...)   P99_CALL_DEFARG(strtol, 3, __VA_ARGS__)
 Default arguments for C99 function strtol.
#define strtold(...)   P99_CALL_DEFARG(strtold, 2, __VA_ARGS__)
 Default arguments for C99 function strtold.
#define strtoll(...)   P99_CALL_DEFARG(strtoll, 3, __VA_ARGS__)
 Default arguments for C99 function strtoll.
#define strtot   p99_strtot
#define strtou   p99_strtou
#define strtou16   p99_strtou16
#define strtou32   p99_strtou32
#define strtou64   p99_strtou64
#define strtou8   p99_strtou8
#define strtouh   p99_strtouh
#define strtouhh   p99_strtouhh
#define strtouj   p99_strtouj
#define strtoul(...)   P99_CALL_DEFARG(strtoul, 3, __VA_ARGS__)
 Default arguments for C99 function strtoul.
#define strtoull(...)   P99_CALL_DEFARG(strtoull, 3, __VA_ARGS__)
 Default arguments for C99 function strtoull.
#define strtoumax(...)   P99_CALL_DEFARG(strtoumax, 3, __VA_ARGS__)
 Default arguments for C99 function strtoumax.
#define strtouz   p99_strtouz
#define wcstod(...)   P99_CALL_DEFARG(wcstod, 2, __VA_ARGS__)
 Default arguments for C99 function wcstod.
#define wcstof(...)   P99_CALL_DEFARG(wcstof, 2, __VA_ARGS__)
 Default arguments for C99 function wcstof.
#define wcstoimax(...)   P99_CALL_DEFARG(wcstoimax, 3, __VA_ARGS__)
 Default arguments for C99 function wcstoimax.
#define wcstol(...)   P99_CALL_DEFARG(wcstol, 3, __VA_ARGS__)
 Default arguments for C99 function wcstol.
#define wcstold(...)   P99_CALL_DEFARG(wcstold, 2, __VA_ARGS__)
 Default arguments for C99 function wcstold.
#define wcstoll(...)   P99_CALL_DEFARG(wcstoll, 3, __VA_ARGS__)
 Default arguments for C99 function wcstoll.
#define wcstoul(...)   P99_CALL_DEFARG(wcstoul, 3, __VA_ARGS__)
 Default arguments for C99 function wcstoul.
#define wcstoull(...)   P99_CALL_DEFARG(wcstoull, 3, __VA_ARGS__)
 Default arguments for C99 function wcstoull.
#define wcstoumax(...)   P99_CALL_DEFARG(wcstoumax, 3, __VA_ARGS__)
 Default arguments for C99 function wcstoumax.

Detailed Description

Extensions of the strto and wcsto families of functions.

This generally adds default behavior and type safety to these standard C99 functions. The standard defines them only for the types long (strtol), long long (strtoll), intmax_t (strtoimax) and their unsigned variants. This here adds support for the other standard integer types and typedef. This provides

In addition to provide default arguments for the standard functions, these have names starting with p99_str... and macros that expand to these starting with str..., instead. The later might be reserved or provided in later version of the C standard. If we receive knowledge of such new interfaces we will bracket the definitions given here with appropriate defines.

We provide interfaces for the standard types char (strtoc), signed (strtohh) and unsigned char (strtouhh), signed (strtoh) and unsigned short (strtouh), and signed (strto) and unsigned int (strtou). For the standard typedefs we provide strtouz for size_t and strtot for ptrdiff_t. Here the endings of the names are taken in analogy from the printf formats.

The type specific upper an lower bounds for all these are the MIN and MAX values of the corresponding types.

For the types {u}int_least[N]_t with N = 8, 16, 32 or 64 we provide functions and macros strto{u|i}[N] that have the bounds INT[N]_MIN, INT[N]_MAX and UINT[N]_MAX, respectively. So e.g for strtou16 the bound is not the bound of the type uint_least16_t (which might be much wider than 16 bit) but the value UINT16_MAX, i.e 216-1.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines