You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cpp/cpp-bit-fields.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@ then the memory layout is as shown in the following figure:
64
64
 <br/>
65
65
Layout of Date Object with Zero-Length Bit Field
66
66
67
-
The underlying type of a bit field must be an integral type, as described in [Fundamental Types](../cpp/fundamental-types-cpp.md).
67
+
The underlying type of a bit field must be an integral type, as described in [Built-in types](../cpp/fundamental-types-cpp.md).
68
68
69
69
If the initializer for a reference of type `const T&` is an lvalue that refers to a bit field of type `T`, the reference is not bound to the bit field directly. Instead, the reference is bound to a temporary initialized to hold the value of the bit field.
Copy file name to clipboardExpand all lines: docs/cpp/cpp-type-system-modern-cpp.md
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,9 +18,7 @@ The concept of *type* is very important in C++. Every variable, function argumen
18
18
19
19
## Specifying variable and function types
20
20
21
-
C++ is a *strongly typed* language and it is also *statically-typed*; every object has a type and that type never changes (not to be confused with static data objects).
22
-
**When you declare a variable** in your code, you must either specify its type explicitly, or use the **auto** keyword to instruct the compiler to deduce the type from the initializer.
23
-
**When you declare a function** in your code, you must specify the type of each argument and its return value, or **void** if no value is returned by the function. The exception is when you are using function templates, which allow for arguments of arbitrary types.
21
+
C++ is a *strongly typed* language and it is also *statically-typed*; every object has a type and that type never changes (not to be confused with static data objects). When you declare a variable in your code, you must either specify its type explicitly, or use the **auto** keyword to instruct the compiler to deduce the type from the initializer. When you declare a function in your code, you must specify the type of each argument and its return value, or **void** if no value is returned by the function. The exception is when you are using function templates, which allow for arguments of arbitrary types.
24
22
25
23
After you first declare a variable, you cannot change its type at some later point. However, you can copy the variable’s value or a function’s return value into another variable of a different type. Such operations are called *type conversions*, which are sometimes necessary but are also potential sources of data loss or incorrectness.
26
24
@@ -49,7 +47,7 @@ int maxValue; // Not recommended! maxValue contains
49
47
50
48
Unlike some languages, C++ has no universal base type from which all other types are derived. The language includes many *fundamental types*, also known as *built-in types*. This includes numeric types such as **int**, **double**, **long**, **bool**, plus the **char** and **wchar_t** types for ASCII and UNICODE characters, respectively. Most fundamental types (except **bool**, **double**, **wchar_t** and related types) all have unsigned versions, which modify the range of values that the variable can store. For example, an **int**, which stores a 32-bit signed integer, can represent a value from -2,147,483,648 to 2,147,483,647. An **unsigned int**, which is also stored as 32-bits, can store a value from 0 to 4,294,967,295. The total number of possible values in each case is the same; only the range is different.
51
49
52
-
The fundamental types are recognized by the compiler, which has built-in rules that govern what operations you can perform on them, and how they can be converted to other fundamental types. For a complete list of built-in types and their size and numeric limits, see [Fundamental Types](../cpp/fundamental-types-cpp.md).
50
+
The fundamental types are recognized by the compiler, which has built-in rules that govern what operations you can perform on them, and how they can be converted to other fundamental types. For a complete list of built-in types and their size and numeric limits, see [Built-in types](../cpp/fundamental-types-cpp.md).
53
51
54
52
The following illustration shows the relative sizes of the built-in types:
Copy file name to clipboardExpand all lines: docs/cpp/data-type-ranges.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,11 +64,11 @@ The **int** and **unsigned int** types have a size of four bytes. However, porta
64
64
65
65
C/C++ in Visual Studio also supports sized integer types. For more information, see [__int8, \__int16, \__int32, \__int64](../cpp/int8-int16-int32-int64.md) and [Integer Limits](../cpp/integer-limits.md).
66
66
67
-
For more information about the restrictions of the sizes of each type, see [Fundamental Types](../cpp/fundamental-types-cpp.md).
67
+
For more information about the restrictions of the sizes of each type, see [Built-in types](../cpp/fundamental-types-cpp.md).
68
68
69
69
The range of enumerated types varies depending on the language context and specified compiler flags. For more information, see [C Enumeration Declarations](../c-language/c-enumeration-declarations.md) and [Enumerations](../cpp/enumerations-cpp.md).
helpviewer_keywords: ["specifiers [C++], type", "float keyword [C++]", "char keyword [C++]", "__wchar_t keyword [C++]", "signed types [C++], summary of data types", "Integer data type [C++], C++ data types", "arithmetic operations [C++], types", "int data type", "unsigned types [C++], summary of data types", "short data type [C++]", "double data type [C++], summary of types", "long long keyword [C++]", "long double keyword [C++]", "unsigned types [C++]", "signed types [C++]", "void keyword [C++]", "storage [C++], basic type", "integral types, C++", "wchar_t keyword [C++]", "floating-point numbers [C++], C++ data types", "long keyword [C++]", "type specifiers [C++]", "integral types", "long keyword [C++]", "storing types [C++]", "data types [C++], void"]
6
6
ms.assetid: 58b0106a-0406-4b74-a430-7cbd315c0f89
7
7
---
8
-
# Fundamental Types (C++)
8
+
# Built-in types (C++)
9
9
10
-
Fundamental types in C++ are divided into three categories: integral, floating point, and void. Integral types are capable of handling whole numbers. Floating point types are capable of specifying values that may have fractional parts.
10
+
Built-in types (also called *fundamental types*) are specified by the C++ language standard and are built into the compiler; they are not defined in any header file. Built-in types are divided into three categories: integral, floating point, and void. Integral types are capable of handling whole numbers. Floating point types are capable of specifying values that may have fractional parts.
11
11
12
-
The [void](../cpp/void-cpp.md) type describes an empty set of values. No variable of type **void** can be specified — it is used primarily to declare functions that return no values or to declare generic pointers to untyped or arbitrarily typed data. Any expression can be explicitly converted or cast to type **void**. However, such expressions are restricted to the following uses:
12
+
The [void](void-cpp.md) type describes an empty set of values. No variable of type **void** can be specified — it is used primarily to declare functions that return no values or to declare generic pointers to untyped or arbitrarily typed data. Any expression can be explicitly converted or cast to type **void**. However, such expressions are restricted to the following uses:
13
13
14
-
- An expression statement. (See [Expressions](../cpp/expressions-cpp.md), for more information.)
14
+
- An expression statement. (See [Expressions](expressions-cpp.md), for more information.)
15
15
16
-
- The left operand of the comma operator. (See [Comma Operator](../cpp/comma-operator.md) for more information.)
16
+
- The left operand of the comma operator. (See [Comma Operator](comma-operator.md) for more information.)
17
17
18
-
- The second or third operand of the conditional operator (`? :`). (See [Expressions with the Conditional Operator](../cpp/conditional-operator-q.md) for more information.)
18
+
- The second or third operand of the conditional operator (`? :`). (See [Expressions with the Conditional Operator](conditional-operator-q.md) for more information.)
19
19
20
-
The following table explains the restrictions on type sizes. These restrictions are independent of the Microsoft implementation.
20
+
The following table explains the restrictions on type sizes in relation to each other. These restrictions are mandated by the C++ standard and are independent of the Microsoft implementation.
21
21
22
-
### Fundamental Types of the C++ Language
22
+
### Built-in type size restrictions
23
23
24
24
|Category|Type|Contents|
25
25
|--------------|----------|--------------|
@@ -37,9 +37,9 @@ The following table explains the restrictions on type sizes. These restrictions
37
37
38
38
**Microsoft Specific**
39
39
40
-
The following table lists the amount of storage required for fundamental types in Microsoft C++.
40
+
The following table lists the amount of storage required for built-in types in Microsoft C++. In particular, note that **long** is 4 bytes even on 64-bit operating systems.
41
41
42
-
### Sizes of Fundamental Types
42
+
### Sizes of built-in types
43
43
44
44
|Type|Size|
45
45
|----------|----------|
@@ -50,10 +50,10 @@ The following table lists the amount of storage required for fundamental types i
50
50
51
51
**END Microsoft Specific**
52
52
53
-
See [Data Type Ranges](../cpp/data-type-ranges.md) for a summary of the range of values of each type.
53
+
See [Data Type Ranges](data-type-ranges.md) for a summary of the range of values of each type.
54
54
55
-
For more information about type conversion, see [Standard Conversions](../cpp/standard-conversions.md).
55
+
For more information about type conversion, see [Standard Conversions](standard-conversions.md).
0 commit comments