X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=includes%2Finttypes.h;h=f13db1bf8d7b250146be6ecf92a5af6a493e1eae;hb=be738e08ec9ba2498d81153bee1de9b8af7e764c;hp=231dfab9408a87df3286500ff31fcf57ad0807af;hpb=b41576197133c1211d6ec353faf93f505f573b8a;p=pdclib diff --git a/includes/inttypes.h b/includes/inttypes.h index 231dfab..f13db1b 100644 --- a/includes/inttypes.h +++ b/includes/inttypes.h @@ -1,6 +1,4 @@ -/* $Id$ */ - -/* 7.8 Format conversion of integer types +/* Format conversion of integer types This file is part of the Public Domain C Library (PDCLib). Permission is granted to use, modify, and / or redistribute at will. @@ -9,8 +7,15 @@ #ifndef _PDCLIB_INTTYPES_H #define _PDCLIB_INTTYPES_H _PDCLIB_INTTYPES_H #include -_PDCLIB_BEGIN_EXTERN_C +#ifdef __cplusplus +extern "C" { +#endif + +/* This structure has a member quot and a member rem, of type intmax_t. + The order of the members is platform-defined to allow the imaxdiv() + function below to be implemented efficiently. +*/ typedef struct _PDCLIB_imaxdiv_t imaxdiv_t; #define PRId8 _PDCLIB_symbol2string( _PDCLIB_concat( _PDCLIB_8_CONV, d ) ) @@ -211,15 +216,15 @@ typedef struct _PDCLIB_imaxdiv_t imaxdiv_t; #define SCNxMAX _PDCLIB_symbol2string( _PDCLIB_concat( _PDCLIB_MAX_CONV, x ) ) #define SCNxPTR _PDCLIB_symbol2string( _PDCLIB_concat( _PDCLIB_PTR_CONV, x ) ) -/* 7.8.2 Functions for greatest-width integer types */ +/* Functions for greatest-width integer types */ /* Calculate the absolute value of j */ -intmax_t imaxabs( intmax_t j ); +intmax_t imaxabs( intmax_t j ) _PDCLIB_nothrow; /* Return quotient (quot) and remainder (rem) of an integer division in the imaxdiv_t struct. */ -imaxdiv_t imaxdiv( intmax_t numer, intmax_t denom ); +imaxdiv_t imaxdiv( intmax_t numer, intmax_t denom ) _PDCLIB_nothrow; /* Seperate the character array nptr into three parts: A (possibly empty) sequence of whitespace characters, a character representation of an integer @@ -240,14 +245,24 @@ imaxdiv_t imaxdiv( intmax_t numer, intmax_t denom ); respectively, depending on the sign of the integer representation and the return type, and errno is set to ERANGE. */ -/* This function is equivalent to strtol() / strtoul() in , but on + +/* These functions are equivalent to strtol() / strtoul() in , but on the potentially larger type. */ -intmax_t strtoimax( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base ); -uintmax_t strtoumax( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base ); +intmax_t strtoimax( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base ) _PDCLIB_nothrow; +uintmax_t strtoumax( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base ) _PDCLIB_nothrow; -/* TODO: wcstoimax(), wcstoumax() */ +/* These functions are equivalent to wcstol() / wcstoul() in , but on + the potentially larger type. +*/ +/* TODO: Not _PDCLIB_nothrow? */ +/* +intmax_t wcstoimax( const _PDCLIB_wchar_t * _PDCLIB_restrict nptr, _PDCLIB_wchar_t * * _PDCLIB_restrict endptr, int base ); +uintmax_t wcstoumax( const _PDCLIB_wchar_t * _PDCLIB_restrict nptr, _PDCLIB_wchar_t * * _PDCLIB_restrict endptr, int base ); +*/ -_PDCLIB_END_EXTERN_C +#ifdef __cplusplus +} #endif +#endif