BloombergLP::bsls::PlatformUtil

Provide a namespace for a suite of typedefs and pure procedures that encapsulate, platform-dependent types and APIs.

Synopsis

Declared in <bsls_platformutil.h>

struct PlatformUtil;

Type Aliases

NameDescription
Int64 64-bit signed integer type for all supported platforms.
IntPtr The aliases UintPtr and IntPtr are guaranteed to have the same size as pointers.
MaxAlign The alias MaxAlign refers to a type that is maximally-aligned on the current platform.
Uint64 The aliases Int64 and Uint64 stand for whatever type Types implements for the appropriate supported platforms.
UintPtr Unsigned integer type guaranteed to have the same size as pointers.
size_type The alias size_type refers to the preferred type for denoting a number of elements in either bslma allocators or container types. Note that this type is signed, as negative values may make sense in certain contexts. Also note that the standard-compliant allocators (e.g., bsl::allocator and std::allocator) use an unsigned size type, but that is fine because they also have a mechanism (max_size) to determine overflows resulting from converting from one size type to the other.

Static Member Functions

NameDescription
isBigEndian Return true if this platform is "big-endian", and false otherwise. Note that "big-endian" (i.e., the most significant byte of data at the lowest byte address) is consistent with network byte order.
isLittleEndian Return true if this platform is "little-endian", and false otherwise. Note that "little-endian" (i.e., the least significant byte of data at the lowest byte address) is inconsistent with network byte order.
roundUpToMaximalAlignment Return the specified size (in bytes) rounded up to the smallest integral multiple of the maximum alignment. The behavior is undefined unless 0 <= size.