P99
Macros
Conversion of strings to integer types

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

+ Collaboration diagram for Conversion of strings to integer types:

Macros

#define p99_strto(...)   P99_CALL_DEFARG(p99_strto, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strto
More...
 
#define p99_strtoc(...)   P99_CALL_DEFARG(p99_strtoc, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtoc
More...
 
#define p99_strtoh(...)   P99_CALL_DEFARG(p99_strtoh, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtoh
More...
 
#define p99_strtohh(...)   P99_CALL_DEFARG(p99_strtohh, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtohh
More...
 
#define p99_strtoi16(...)   P99_CALL_DEFARG(p99_strtoi16, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtoi16
More...
 
#define p99_strtoi32(...)   P99_CALL_DEFARG(p99_strtoi32, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtoi32
More...
 
#define p99_strtoi64(...)   P99_CALL_DEFARG(p99_strtoi64, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtoi64
More...
 
#define p99_strtoi8(...)   P99_CALL_DEFARG(p99_strtoi8, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtoi8
More...
 
#define p99_strtot(...)   P99_CALL_DEFARG(p99_strtot, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtot
More...
 
#define p99_strtou(...)   P99_CALL_DEFARG(p99_strtou, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtou
More...
 
#define p99_strtou16(...)   P99_CALL_DEFARG(p99_strtou16, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtou16
More...
 
#define p99_strtou32(...)   P99_CALL_DEFARG(p99_strtou32, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtou32
More...
 
#define p99_strtou64(...)   P99_CALL_DEFARG(p99_strtou64, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtou64
More...
 
#define p99_strtou8(...)   P99_CALL_DEFARG(p99_strtou8, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtou8
More...
 
#define p99_strtouh(...)   P99_CALL_DEFARG(p99_strtouh, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtouh
More...
 
#define p99_strtouhh(...)   P99_CALL_DEFARG(p99_strtouhh, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtouhh
More...
 
#define p99_strtouz(...)   P99_CALL_DEFARG(p99_strtouz, 3, __VA_ARGS__)
 Default arguments for C99 function p99_strtouz
More...
 
#define strto   p99_strto
 
#define strtoc   p99_strtoc
 
#define strtod(...)   P99_CALL_DEFARG(strtod, 2, __VA_ARGS__)
 Default arguments for C99 function strtod
More...
 
#define strtof(...)   P99_CALL_DEFARG(strtof, 2, __VA_ARGS__)
 Default arguments for C99 function strtof
More...
 
#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
More...
 
#define strtoj   p99_strtoj
 
#define strtol(...)   P99_CALL_DEFARG(strtol, 3, __VA_ARGS__)
 Default arguments for C99 function strtol
More...
 
#define strtold(...)   P99_CALL_DEFARG(strtold, 2, __VA_ARGS__)
 Default arguments for C99 function strtold
More...
 
#define strtoll(...)   P99_CALL_DEFARG(strtoll, 3, __VA_ARGS__)
 Default arguments for C99 function strtoll
More...
 
#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
More...
 
#define strtoull(...)   P99_CALL_DEFARG(strtoull, 3, __VA_ARGS__)
 Default arguments for C99 function strtoull
More...
 
#define strtoumax(...)   P99_CALL_DEFARG(strtoumax, 3, __VA_ARGS__)
 Default arguments for C99 function strtoumax
More...
 
#define strtouz   p99_strtouz
 
#define wcstod(...)   P99_CALL_DEFARG(wcstod, 2, __VA_ARGS__)
 Default arguments for C99 function wcstod
More...
 
#define wcstof(...)   P99_CALL_DEFARG(wcstof, 2, __VA_ARGS__)
 Default arguments for C99 function wcstof
More...
 
#define wcstoimax(...)   P99_CALL_DEFARG(wcstoimax, 3, __VA_ARGS__)
 Default arguments for C99 function wcstoimax
More...
 
#define wcstol(...)   P99_CALL_DEFARG(wcstol, 3, __VA_ARGS__)
 Default arguments for C99 function wcstol
More...
 
#define wcstold(...)   P99_CALL_DEFARG(wcstold, 2, __VA_ARGS__)
 Default arguments for C99 function wcstold
More...
 
#define wcstoll(...)   P99_CALL_DEFARG(wcstoll, 3, __VA_ARGS__)
 Default arguments for C99 function wcstoll
More...
 
#define wcstoul(...)   P99_CALL_DEFARG(wcstoul, 3, __VA_ARGS__)
 Default arguments for C99 function wcstoul
More...
 
#define wcstoull(...)   P99_CALL_DEFARG(wcstoull, 3, __VA_ARGS__)
 Default arguments for C99 function wcstoull
More...
 
#define wcstoumax(...)   P99_CALL_DEFARG(wcstoumax, 3, __VA_ARGS__)
 Default arguments for C99 function wcstoumax
More...
 

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.

p99_strtou16
#define p99_strtou16(...)
Default arguments for C99 function p99_strtou16
Definition: p99_c99_default.h:399
p99_strtou
#define p99_strtou(...)
Default arguments for C99 function p99_strtou
Definition: p99_c99_default.h:349
wcstoul
#define wcstoul(...)
Default arguments for C99 function wcstoul
Definition: p99_c99_default.h:130
uintmax_t
uintmax_t
Definition: p99_str.h:117
strtoll
#define strtoll(...)
Default arguments for C99 function strtoll
Definition: p99_c99_default.h:190
p99_strtot
#define p99_strtot(...)
Default arguments for C99 function p99_strtot
Definition: p99_c99_default.h:365
strtol
#define strtol(...)
Default arguments for C99 function strtol
Definition: p99_c99_default.h:177
p99_strtoi8
#define p99_strtoi8(...)
Default arguments for C99 function p99_strtoi8
Definition: p99_c99_default.h:357
p99_strtohh
#define p99_strtohh(...)
Default arguments for C99 function p99_strtohh
Definition: p99_c99_default.h:308
ptrdiff_t
ptrdiff_t
Definition: p99_str.h:101
wcstol
#define wcstol(...)
Default arguments for C99 function wcstol
Definition: p99_c99_default.h:105
wcstoull
#define wcstoull(...)
Default arguments for C99 function wcstoull
Definition: p99_c99_default.h:138
wcstoll
#define wcstoll(...)
Default arguments for C99 function wcstoll
Definition: p99_c99_default.h:114
strtold
#define strtold(...)
Default arguments for C99 function strtold
Definition: p99_c99_default.h:241
p99_strtouhh
#define p99_strtouhh(...)
Default arguments for C99 function p99_strtouhh
Definition: p99_c99_default.h:316
p99_strtouz
#define p99_strtouz(...)
Default arguments for C99 function p99_strtouz
Definition: p99_c99_default.h:373
p99_strtoh
#define p99_strtoh(...)
Default arguments for C99 function p99_strtoh
Definition: p99_c99_default.h:325
strtoumax
#define strtoumax(...)
Default arguments for C99 function strtoumax
Definition: p99_c99_default.h:222
wcstold
#define wcstold(...)
Default arguments for C99 function wcstold
Definition: p99_c99_default.h:165
strtod
#define strtod(...)
Default arguments for C99 function strtod
Definition: p99_c99_default.h:235
wcstof
#define wcstof(...)
Default arguments for C99 function wcstof
Definition: p99_c99_default.h:153
strtof
#define strtof(...)
Default arguments for C99 function strtof
Definition: p99_c99_default.h:229
strtoull
#define strtoull(...)
Default arguments for C99 function strtoull
Definition: p99_c99_default.h:214
wcstod
#define wcstod(...)
Default arguments for C99 function wcstod
Definition: p99_c99_default.h:159
p99_strtoi32
#define p99_strtoi32(...)
Default arguments for C99 function p99_strtoi32
Definition: p99_c99_default.h:407
p99_strtouh
#define p99_strtouh(...)
Default arguments for C99 function p99_strtouh
Definition: p99_c99_default.h:333
strtoul
#define strtoul(...)
Default arguments for C99 function strtoul
Definition: p99_c99_default.h:206
p99_strtou8
#define p99_strtou8(...)
Default arguments for C99 function p99_strtou8
Definition: p99_c99_default.h:382
p99_strtou32
#define p99_strtou32(...)
Default arguments for C99 function p99_strtou32
Definition: p99_c99_default.h:416
p99_strtoi16
#define p99_strtoi16(...)
Default arguments for C99 function p99_strtoi16
Definition: p99_c99_default.h:390
p99_strtou64
#define p99_strtou64(...)
Default arguments for C99 function p99_strtou64
Definition: p99_c99_default.h:434
strtoimax
#define strtoimax(...)
Default arguments for C99 function strtoimax
Definition: p99_c99_default.h:198
p99_strtoc
#define p99_strtoc(...)
Default arguments for C99 function p99_strtoc
Definition: p99_c99_default.h:300
p99_strto
#define p99_strto(...)
Default arguments for C99 function p99_strto
Definition: p99_c99_default.h:291
wcstoumax
#define wcstoumax(...)
Default arguments for C99 function wcstoumax
Definition: p99_c99_default.h:146
p99_strtoi64
#define p99_strtoi64(...)
Default arguments for C99 function p99_strtoi64
Definition: p99_c99_default.h:425
wcstoimax
#define wcstoimax(...)
Default arguments for C99 function wcstoimax
Definition: p99_c99_default.h:122