Artifact a0dcf00d0946ccdc969c4b9d053e49a570a65f32b99611542daefbc50eb0c6ec:

  • File cxxomfort/cxxomfort/cstdint.hpp — part of check-in [9229196f] at 2020-07-27 05:40:26 on branch trunk — Commit 2020-07-25 - Bugfixes and helpers for C++98.

    Bugfixes and improvements on MSVC 2005, OpenWatcom compatibility. (user: luismachuca size: 2998)


#ifndef CXXOMFORT_CSTDINT_HPP
#define CXXOMFORT_CSTDINT_HPP
/**
 * @file
 * @brief Implementations and additions tied to Standard header <tt>\<cstdint\></tt>.
 * @ingroup std0cstdint
 * 
 * This file will, when included, attempt to find and @c \#include  whichever 
 * headers provide the integer named types such as @c int16_t .
 * 
 */


#include <cxxomfort/base.hpp>
#include <cxxomfort/cxxo-utils.hpp> // tinyint_
#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
	#pragma message CXXO_NOTICE("enabled <cstdint> support.")
#endif
#if (CXXOMFORT_CXX_STD>=2011)
	#include <cstdint>
	#undef  CXXOMFORT_IMPLEMENTS_cstdint_integrals
	#define CXXOMFORT_IMPLEMENTS_cstdint_integrals CXXO_IMPLSTATUS_NATIVE()
#else
	//#include <inttypes.h>
	#include <cxxomfort/base/cstdint.hpp>
#endif

// 
// tinyint
// ([u]uint8_t as an actual, functional numeric type)
// 


namespace cxxomfort { 

/**
 * @brief Numeric type that models a 1-byte signed int (like @c int8_t ).
 * */
typedef tinyint_<signed char> tinyint;
/**
 * @brief Numeric type that models a 1-byte unsigned int (like @c uint8_t ).
 * */
typedef tinyint_<unsigned char> tinyuint;

static_assert (sizeof(tinyint)==1 && alignof(tinyint)==1, "tinyint check");
static_assert (alignof(tinyuint)==1 && alignof(tinyuint)==1, "tinyuint check");


namespace fix {
	using cxxomfort::tinyint;
	using cxxomfort::tinyuint;
}

}

/**
 * @page std0cstdint <cstdint>
 * @brief Features related to Standard header <code>\<cstdint\></code>.
 * 
 * @section Interfaces
 * 
 * Features declared here include mostly the special type names for the supported integer ("integral") types that are defined by the compiler:
 * 
 * * Candidate size integer typedefs <code>[u]int_least<em>n</em>_t</code> such as @c int_least32_t .
 * * Exact size integer typedefs <code>[u]int<em>n</em>_t</code> such as @c int32_t .
 * * Fast arithmetic integer typedefs <code>uint_fast<em>n</em>_t</code> such as @c int_fast32_t .
 * * Maximum-size integer typedef @c intmax_t , @c uintmax_t .
 * * Pointer-sized integer typedefs @c intptr_t , @c uintptr_t .
 * 
 * The following non-backport interfaces are defined:
 * 
 * * @c cxxomfort::tinyint , @c cxxomfort::tinyuint - true numerical types with the same semantics of <tt>signed char, unsigned char</tt>.
 * * @c cxxomfort::fix::uint8_t - a true numeric integral type with the semantics of @c u8int_t .
 * 
 * For platforms without access to a Standard <code><stdint.h></code>, 
 * cxxomfort makes this possible by providing a copy of 
 * <em>pstdint.h the Portable stdint</em>.
 * 
 * @warning For the definition of these types, cxxomfort assumes that the native type <code>long long</code> is available, even in C++03 mode. 
 * Using a platform without such type is <b>unsupported</b> but can be tried by defining the @link cxxomfort-behaviour "Configuration macro" @endlink 
 * <code>CXXOFLAG_WITHOUT_LONGLONG</code>.
 * 
 * @section also See Also
 * 
 * @see @cppref{header/cstdint} (cppreference) 
 * 
 * **/

#endif