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
@@ -78,7 +78,7 @@ You can use the [`comment`](../../preprocessor/comment-c-cpp.md) pragma to speci
78
78
|[`/LARGEADDRESSAWARE`](largeaddressaware-handle-large-addresses.md)| Tells the compiler that the application supports addresses larger than 2 gigabytes |
79
79
|[`/LIBPATH`](libpath-additional-libpath.md)| Specifies a path to search before the environmental library path. |
80
80
|[`/LINKREPRO`](linkrepro.md)| Specifies a path to generate link repro artifacts in. |
81
-
|[`LINKREPROFULLPATHRSP`](link-repro-full-path-rsp.md)| Generates a response file containing the absolute paths to all the files that the linker took as input. |
81
+
|[`/LINKREPROFULLPATHRSP`](link-repro-full-path-rsp.md)| Generates a response file containing the absolute paths to all the files that the linker took as input. |
82
82
|[`/LINKREPROTARGET`](linkreprotarget.md)| Generates a link repro only when producing the specified target.<sup>16.1</sup> |
The C++ language provides that if a class is derived from a base class containing virtual functions, a pointer to that base class type can be used to call the implementations of the virtual functions residing in the derived class object. A class containing virtual functions is sometimes called a "polymorphic class."
10
+
In C++, if a class is derived from a base class containing one or more virtual functions, a pointer to that base class type can be used to call virtual functions in the derived class object. A class containing virtual functions is sometimes called a "polymorphic class."
11
11
12
-
Since a derived class completely contains the definitions of all the base classes from which it is derived, it is safe to cast a pointer up the class hierarchy to any of these base classes. Given a pointer to a base class, it might be safe to cast the pointer down the hierarchy. It is safe if the object being pointed to is actually of a type derived from the base class. In this case, the actual object is said to be the "complete object." The pointer to the base class is said to point to a "subobject" of the complete object. For example, consider the class hierarchy shown in the following figure.
13
-
14
-
 <br/>
12
+
<br/>
15
13
Class hierarchy
16
14
17
-
An object of type `C`could be visualized as shown in the following figure.
15
+
An object of type `C`can be visualized as follows:
18
16
19
17
 <br/>
20
-
Class C with sub-objects B and A
18
+
Class C with subobjects B and A
21
19
22
-
Given an instance of class `C`, there is a `B` subobject and an `A` subobject. The instance of `C`, including the `A` and `B` subobjects, is the "complete object."
20
+
Given an instance of class `C`, there's a `B` subobject and an `A` subobject. The instance of `C`, including the `A` and `B` subobjects, is the "complete object."
23
21
24
-
Using run-time type information, it is possible to check whether a pointer actually points to a complete object and can be safely cast to point to another object in its hierarchy. The [dynamic_cast](../cpp/dynamic-cast-operator.md) operator can be used to make these types of casts. It also performs the run-time check necessary to make the operation safe.
22
+
Because a derived class completely contains the definitions of all the base classes from which it's derived, it's safe to cast a pointer to any of its base classes (also called an upcast). Given a pointer to a base class, it may be safe to cast the pointer to an instance of a derived class (also called a downcast).
25
23
26
-
For conversion of nonpolymorphic types, you can use the [static_cast](../cpp/static-cast-operator.md) operator (this topic explains the difference between static and dynamic casting conversions, and when it is appropriate to use each).
24
+
Using run-time type information, it's possible to check whether a pointer actually points to a complete object and can be safely cast to point to another object in its hierarchy. The [dynamic_cast](../cpp/dynamic-cast-operator.md) operator performs a run-time check to ensure that the operation is safe. It's better to design your class hierarchy so that you can use virtual functions to avoid the need for downcasting. However, if you must downcast, use `dynamic_cast` to ensure that the operation is safe.
27
25
28
-
This section covers the following topics:
26
+
For conversion of nonpolymorphic types, you can use the [static_cast](../cpp/static-cast-operator.md) operator (this topic explains the difference between static and dynamic casting conversions, and when it's appropriate to use each).
27
+
28
+
The following example demonstrates the use of `dynamic_cast` and `static_cast`:
Copy file name to clipboardExpand all lines: docs/cpp/data-type-ranges.md
+17-23Lines changed: 17 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,31 +3,25 @@ description: "Learn more about: Data Type Ranges"
3
3
title: "Data Type Ranges"
4
4
ms.date: "05/28/2020"
5
5
helpviewer_keywords: ["float keyword [C++]", "char keyword [C++]", "unsigned long", "__wchar_t keyword [C++]", "unsigned short int [C++]", "enum keyword [C++]", "unsigned char keyword [C++]", "integer data type [C++], data type ranges", "int data type", "data types [C++], ranges", "unsigned int [C++]", "short data type", "short int data", "signed types [C++], data type ranges", "long long keyword [C++]", "long double keyword [C++]", "double data type [C++], data type ranges", "signed short int [C++]", "unsigned short", "sized integer types", "signed int [C++]", "signed long int [C++]", "signed char keyword [C++]", "wchar_t keyword [C++]", "long keyword [C++]", "ranges [C++]", "unsigned types [C++], data type ranges", "floating-point numbers [C++]", "data type ranges", "ranges [C++], data types", "long int keyword [C++]", "unsigned long int [C++]"]
6
-
ms.assetid: 3691ceca-05fb-4b82-b1ae-5c4618cda91a
7
6
---
8
7
# Data Type Ranges
9
8
10
9
The Microsoft C++ 32-bit and 64-bit compilers recognize the types in the table later in this article.
11
10
12
-
-**`int`** (**`unsigned int`**)
11
+
```cpp
12
+
- int (unsignedint)
13
+
- __int8 (unsigned __int8)
14
+
- __int16 (unsigned __int16)
15
+
- __int32 (unsigned __int32)
16
+
- __int64 (unsigned __int64)
17
+
- short (unsignedshort)
18
+
- long (unsignedlong)
19
+
- longlong (unsigned long long)
20
+
```
13
21
14
-
-**`__int8`** (**`unsigned __int8`**)
22
+
If its name begins with two underscores (`__`), the data type is nonstandard.
15
23
16
-
-**`__int16`** (**`unsigned __int16`**)
17
-
18
-
-**`__int32`** (**`unsigned __int32`**)
19
-
20
-
-**`__int64`** (**`unsigned __int64`**)
21
-
22
-
-**`short`** (**`unsigned short`**)
23
-
24
-
-**`long`** (**`unsigned long`**)
25
-
26
-
-**`long long`** (**`unsigned long long`**)
27
-
28
-
If its name begins with two underscores (`__`), a data type is non-standard.
29
-
30
-
The ranges that are specified in the following table are inclusive-inclusive.
24
+
The ranges specified in the following table are inclusive-inclusive.
|**`long double`**|same as **`double`**|none|Same as **`double`**|
58
52
|**`wchar_t`**|2|**`__wchar_t`**|0 to 65,535|
59
53
60
-
Depending on how it's used, a variable of **`__wchar_t`** designates either a wide-character type or multibyte-character type. Use the `L` prefix before a character or string constant to designate the wide-character-type constant.
54
+
A variable of **`__wchar_t`** designates either a wide-character type or multibyte-character type. Use the `L` prefix before a character or string constant to designate the wide-character-type constant.
61
55
62
56
**`signed`** and **`unsigned`** are modifiers that you can use with any integral type except **`bool`**. Note that **`char`**, **`signed char`**, and **`unsigned char`** are three distinct types for the purposes of mechanisms like overloading and templates.
63
57
64
-
The **`int`** and **`unsigned int`** types have a size of four bytes. However, portable code should not depend on the size of **`int`** because the language standard allows this to be implementation-specific.
58
+
The **`int`** and **`unsigned int`** types have a size of 4 bytes. However, portable code shouldn't depend on the size of **`int`** because the language standard allows this to be implementation-specific.
65
59
66
60
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).
67
61
@@ -71,5 +65,5 @@ The range of enumerated types varies depending on the language context and speci
description: "Learn more about: Compiler Error C2055"
3
-
title: "Compiler Error C2055"
4
-
ms.date: "11/04/2016"
2
+
description: "Learn more about: Microsoft Visual C++ compiler error C2055"
3
+
title: "Compiler error C2055"
4
+
ms.date: 06/10/2024
5
5
f1_keywords: ["C2055"]
6
6
helpviewer_keywords: ["C2055"]
7
-
ms.assetid: 6cec79cc-6bec-443f-9897-fbf5452718c7
8
7
---
9
-
# Compiler Error C2055
8
+
# Compiler error C2055
10
9
11
-
expected formal parameter list, not a type list
10
+
> expected formal parameter list, not a type list
12
11
13
-
A function definition contains a parameter type list instead of a formal parameter list. ANSI C requires formal parameters to be named unless they are void or an ellipsis (`...`).
12
+
A function definition contains a parameter type list instead of a formal parameter list. ANSI C requires formal parameters to be named unless they're `void` or an ellipsis (`...`).
14
13
15
-
The following sample generates C2055:
14
+
An example of a named formal parameter is the `int i` in `void func(int i)`.\
15
+
A parameter type list is a list of types, for example, `int, char`.
0 commit comments