GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing timsong-cpp.github.io — [basic.fundamental] 6 Basics [basic]6.9 Types [basic.types]6.9.3 Fundamental types [basic.fundamental]There are five standard signed integer types:
“signed char”, “short int”, “int”,
“long int”, and “long long int”. In
this list, each type provides at least as much storage as those
preceding it in the list. There may also be implementation-defined
extended signed integer types. The standard and extended signed integer types are collectively called
signed integer types. For each of the standard signed integer types,
there exists a corresponding (but different)
standard unsigned integer type:
“unsigned char”, “unsigned short int”,
“unsigned int”, “unsigned long int”, and
“unsigned long long int”. Likewise, for each of the extended signed integer types,
there exists a corresponding extended unsigned integer type. The standard and extended unsigned integer types
are collectively called unsigned integer types. An unsigned integer type has the same width N
as the corresponding signed integer type. The range of representable values for the unsigned type is
0 to 2N−1 (inclusive);
arithmetic for the unsigned type is performed modulo 2N. [Note 1: Unsigned arithmetic does not overflow. Overflow for signed arithmetic yields undefined behavior ([expr.pre]). — end note]An unsigned integer type has the same
object representation,
value representation, and
alignment requirements ([basic.align])
as the corresponding signed integer type. The width of each standard signed integer type
shall not be less than the values specified in Table 14. The value representation of a signed or unsigned integer type
comprises N bits, where N is the respective width. Each set of values for any padding bits ([basic.types.general])
in the object representation are
alternative representations of the value specified by the value representation.
Except as specified above,
the width of a signed or unsigned integer type is
implementation-defined. Each value x of an unsigned integer type with width N has
a unique representation x=x020+x121+…+xN−12N−1,
where each coefficient xi is either 0 or 1;
this is called the base-2 representation of x. The base-2 representation of a value of signed integer type is
the base-2 representation of the congruent value
of the corresponding unsigned integer type. The standard signed integer types and standard unsigned integer types
are collectively called the standard integer types, and the extended
signed integer types and extended
unsigned integer types are collectively called the
extended integer types. A fundamental type specified to have
a signed or unsigned integer type as its underlying type has
the same object representation,
value representation,
alignment requirements ([basic.align]), and
range of representable values as the underlying type. Further, each value has the same representation in both types. Type char is a distinct type
that has an implementation-defined choice of
“signed char” or “unsigned char” as its underlying type. The three types char, signed char, and unsigned char
are collectively called
ordinary character types. For narrow character types,
each possible bit pattern of the object representation represents
a distinct value. [Note 5: A bit-field of narrow character type whose width is larger than
the width of that type has padding bits; see [basic.types.general]. — end note]Type wchar_t is a distinct type that has
an implementation-defined
signed or unsigned integer type as its underlying type. Type bool is a distinct type that has
the same object representation,
value representation, and
alignment requirements as
an implementation-defined unsigned integer type. The character types, bool,
the signed and unsigned integer types,
and cv-qualified versions ([basic.type.qualifier]) thereof,
are collectively termed
integral types. A synonym for integral type is integer type. [Note 7: Enumerations ([dcl.enum]) are not integral;
however, unscoped enumerations can be promoted to integral types
as specified in [conv.prom]. — end note]The type double provides at least as much
precision as float, and the type long double provides at
least as much precision as double. The set of values of the type
float is a subset of the set of values of the type
double; the set of values of the type double is a subset
of the set of values of the type long double. The types
float, double, and long double,
and cv-qualified versions ([basic.type.qualifier]) thereof,
are collectively termed
standard floating-point types. An implementation may also provide additional types
that represent floating-point values and define them (and cv-qualified versions thereof) to be
extended floating-point types. The standard and extended floating-point types
are collectively termed floating-point types. [Note 8: Any additional implementation-specific types representing floating-point values
that are not defined by the implementation to be extended floating-point types
are not considered to be floating-point types, and
this document imposes no requirements on them or
their interactions with floating-point types. — end note]
Except as specified in [basic.extended.fp],
the object and value representations and accuracy of operations
of floating-point types are implementation-defined. The minimum range of representable values for a floating-point type is
the most negative finite floating-point number representable
in that type through
the most positive finite floating-point number representable in that type. In addition, if negative infinity is representable in a type,
the range of representable values of that type is extended to all negative real numbers;
likewise, if positive infinity is representable in a type,
the range of representable values of that type is extended to all positive real numbers. A type cv void
is an incomplete type that cannot be completed; such a type has
an empty set of values. [Note 11: An expression of type cv void can be used as
— end note]
Such values participate in the pointer and the
pointer-to-member conversions ([conv.ptr], [conv.mem]). The size ([expr.sizeof]) and alignment requirement ([basic.align]) of
the type std::nullptr_t are those of
the type “pointer to void”. [Note 12: The value representation can comprise no bits ([conv.lval]). — end note]There exists a unique null reflection;
every other reflection is a representation of
[Example 2: int arr[] = {1, 2, 3};
auto [a1, a2, a3] = arr;
[[=1]] void fn(int n);
enum Enum { A };
using Alias = int;
struct B {};
struct S : B {
int mem;
int : 0;
};
template<auto> struct TCls {};
template<auto> void TFn();
template<auto> int TVar;
template<auto N> using TAlias = TCls<N>;
template<auto> concept Concept = requires { true; };
namespace NS {};
namespace NSAlias = NS;
constexpr auto ctx = std::meta::access_context::current();
constexpr auto r1 = std::meta::reflect_constant(42); // represents int value of 42
constexpr auto r2 = std::meta::reflect_object(arr[1]); // represents int object
constexpr auto r3 = ^^arr; // represents a variable
constexpr auto r4 = ^^a3; // represents a structured binding
constexpr auto r5 = ^^fn; // represents a function
constexpr auto r6 = std::meta::parameters_of(^^fn)[0]; // represents a function parameter
constexpr auto r7 = ^^Enum::A; // represents an enumerator
constexpr auto r8 = std::meta::annotations_of(^^fn)[0]; // represents an annotation
constexpr auto r9 = ^^Alias; // represents a type alias
constexpr auto r10 = ^^S; // represents a type
constexpr auto r11 = ^^S::mem; // represents a class member
constexpr auto r12 = std::meta::members_of(^^S, ctx)[1]; // represents an unnamed bit-field
constexpr auto r13 = ^^TCls; // represents a class template
constexpr auto r14 = ^^TFn; // represents a function template
constexpr auto r15 = ^^TVar; // represents a variable template
constexpr auto r16 = ^^TAlias; // represents an alias template
constexpr auto r17 = ^^Concept; // represents a concept
constexpr auto r18 = ^^NSAlias; // represents a namespace alias
constexpr auto r19 = ^^NS; // represents a namespace
constexpr auto r20 = std::meta::bases_of(^^S, ctx)[0]; // represents a direct base class relationship
constexpr auto r21 =
std::meta::data_member_spec(^^int, {.name="member"}); // represents a data member description
— end example] Recommended practice: Implementations should not represent other constructs
specified in this document, such as
using-declarators,
partial template specializations,
attributes, placeholder types,
statements, or
expressions,
as values of type std::meta::info. The types described in this subclause
are called fundamental types. |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |