Сводка типов данных (Visual Basic) Data Type Summary (Visual Basic)
В следующей таблице показаны типы данных Visual Basic, Поддерживаемые типы среды CLR, их номинальное выделение памяти и диапазоны значений. The following table shows the Visual Basic data types, their supporting common language runtime types, their nominal storage allocation, and their value ranges.
Тип Visual Basic Visual Basic type | Структура типа среды CLR Common language runtime type structure | Номинальное выделение памяти Nominal storage allocation | Диапазон значений Value range |
---|---|---|---|
Логический Boolean | Boolean | Зависит от реализации платформы Depends on implementing platform | True либо False True or False |
Byte Byte | Byte | 1 байт 1 byte | от 0 до 255 (без знака) 0 through 255 (unsigned) |
Char (одиночный символ) Char (single character) | Char | 2 байта 2 bytes | от 0 до 65535 (без знака) 0 through 65535 (unsigned) |
Дата Date | DateTime | 8 байт 8 bytes | 0:00:00 (полночь) 1 января 0001 г. по 11:59:59 – 31 декабря 9999 0:00:00 (midnight) on January 1, 0001 through 11:59:59 PM on December 31, 9999 |
Десятичное число Decimal | Decimal | 16 байт 16 bytes | от 0 до +/-79,228,162,514,264,337,593,543,950,335 (+/-7.9. E + 28) † без десятичной запятой; от 0 до +/-7.9228162514264337593543950335 с 28 разрядами справа от десятичного разделителя; 0 through +/-79,228,162,514,264,337,593,543,950,335 (+/-7.9. E+28) † with no decimal point; 0 through +/-7.9228162514264337593543950335 with 28 places to the right of the decimal; наименьшее ненулевое число — +/-0,0000000000000000000000000001 (+/-1E-28) † smallest nonzero number is +/-0.0000000000000000000000000001 (+/-1E-28) † |
Double (число с плавающей запятой двойной точности) Double (double-precision floating-point) | Double | 8 байт 8 bytes | -1.79769313486231570 e + 308 до-4.94065645841246544 E-324 † для отрицательных значений; -1.79769313486231570E+308 through -4.94065645841246544E-324 † for negative values; 4.94065645841246544 e-324 до 1.79769313486231570 E + 308 † для положительных значений 4.94065645841246544E-324 through 1.79769313486231570E+308 † for positive values |
Integer Integer | Int32 | 4 байта 4 bytes | от-2 147 483 648 до 2 147 483 647 (подписано) -2,147,483,648 through 2,147,483,647 (signed) |
Long (длинное целое) Long (long integer) | Int64 | 8 байт 8 bytes | от-9223372036854775808 до 9 223 372 036 854 775 807 (от а до 18 † ) (подписано) -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807 (9.2. E+18 † ) (signed) |
Объект Object | Object см Object (class) | 4 байта на 32-разрядной платформе 4 bytes on 32-bit platform 8 байт на 64-разрядной платформе 8 bytes on 64-bit platform | Любой тип может храниться в переменной типа Object Any type can be stored in a variable of type Object |
SByte SByte | SByte | 1 байт 1 byte | от-128 до 127 (подписано) -128 through 127 (signed) |
Short (короткое целое) Short (short integer) | Int16 | 2 байта 2 bytes | от-32 768 до 32 767 (подписано) -32,768 through 32,767 (signed) |
Single (с плавающей запятой одиночной точности) Single (single-precision floating-point) | Single | 4 байта 4 bytes | -4028235E e + 38 – 1.401298 E-45 † для отрицательных значений; -3.4028235E+38 through -1.401298E-45 † for negative values; 1.401298 e-45 до 4028235E E + 38 † для положительных значений 1.401298E-45 through 3.4028235E+38 † for positive values |
Строка (переменная длина) String (variable-length) | String см String (class) | Зависит от реализации платформы Depends on implementing platform | от 0 до приблизительно 2 000 000 000 символов Юникода 0 to approximately 2 billion Unicode characters |
UInteger UInteger | UInt32 | 4 байта 4 bytes | от 0 до 4 294 967 295 (без знака) 0 through 4,294,967,295 (unsigned) |
ULong ULong | UInt64 | 8 байт 8 bytes | от 0 до 18446744073709551615 (1.8. E + 19 † ) (без знака) 0 through 18,446,744,073,709,551,615 (1.8. E+19 † ) (unsigned) |
Определяемый пользователем (структура) User-Defined (structure) | (наследует от ValueType ) (inherits from ValueType) | Зависит от реализации платформы Depends on implementing platform | Каждый элемент структуры имеет диапазон, определяемый типом данных и не зависящий от диапазонов других элементов. Each member of the structure has a range determined by its data type and independent of the ranges of the other members |
UShort UShort | UInt16 | 2 байта 2 bytes | от 0 до 65 535 (без знака) 0 through 65,535 (unsigned) |
† В экспоненциальном представлении«E» означает степень числа 10. † In scientific notation, «E» refers to a power of 10. Итак, 3.56 E + 2 означает 3,56 x 10 или 356, а 3.56 e-2 — 3,56/10 2 или 0,0356. So 3.56E+2 signifies 3.56 x 10 2 or 356, and 3.56E-2 signifies 3.56 / 10 2 or 0.0356.
Для строк, содержащих текст, используйте StrConv функцию для преобразования одного текстового формата в другой. For strings containing text, use the StrConv function to convert from one text format to another.
Помимо указания типа данных в операторе объявления, можно принудительно задать тип данных некоторых элементов программирования с помощью символа типа. In addition to specifying a data type in a declaration statement, you can force the data type of some programming elements by using a type character. См. раздел символы типа. See Type Characters.
Затраты памяти Memory Consumption
При объявлении простейшего типа данных нельзя считать, что его потребление памяти совпадает с номинальным выделением хранилища. When you declare an elementary data type, it is not safe to assume that its memory consumption is the same as its nominal storage allocation. Это обусловлено следующими соображениями. This is due to the following considerations:
Назначение хранилища. Storage Assignment. Среда CLR может назначать хранилище на основе текущих характеристик платформы, в которой выполняются приложения. The common language runtime can assign storage based on the current characteristics of the platform on which your application is executing. Если память почти заполнена, она может упаковать объявленные элементы как можно ближе друг к другу. If memory is nearly full, it might pack your declared elements as closely together as possible. В других случаях адреса памяти могут быть согласованы с естественными аппаратными границами для оптимизации производительности. In other cases it might align their memory addresses to natural hardware boundaries to optimize performance.
Ширина платформы. Platform Width. Назначение хранилища на 64-разрядной платформе отличается от назначения на 32-разрядной платформе. Storage assignment on a 64-bit platform is different from assignment on a 32-bit platform.
Составные типы данных Composite Data Types
Те же рекомендации применимы к каждому элементу составного типа данных, такому как структура или массив. The same considerations apply to each member of a composite data type, such as a structure or an array. Вы не можете полагаться на простое сложение номинальных выделений памяти для членов типа. You cannot rely on simply adding together the nominal storage allocations of the type’s members. Кроме того, существуют и другие рекомендации, например следующие: Furthermore, there are other considerations, such as the following:
За. Overhead. Некоторые составные типы предъявляют дополнительные требования к памяти. Some composite types have additional memory requirements. Например, массив использует дополнительную память для самого массива, а также для каждого измерения. For example, an array uses extra memory for the array itself and also for each dimension. На 32-разрядной платформе этот объем накладных расходов в настоящее время составляет 12 байт плюс 8 байт для каждого измерения. On a 32-bit platform, this overhead is currently 12 bytes plus 8 bytes for each dimension. На 64-разрядной платформе это требование удваивается. On a 64-bit platform this requirement is doubled.
Структура хранилища. Storage Layout. Нельзя безопасно предположить, что порядок хранения в памяти совпадает с порядком объявления. You cannot safely assume that the order of storage in memory is the same as your order of declaration. Вы даже не можете делать предположения относительно выравнивания байтов, например 2-байтовой или 4-байтовой границы. You cannot even make assumptions about byte alignment, such as a 2-byte or 4-byte boundary. При определении класса или структуры и необходимости управления структурой хранения его элементов можно применить StructLayoutAttribute атрибут к классу или структуре. If you are defining a class or structure and you need to control the storage layout of its members, you can apply the StructLayoutAttribute attribute to the class or structure.
Издержки объекта Object Overhead
При Object ссылке на любой простой или составной тип данных в дополнение к данным, содержащимся в типе данных, используется 4 байта. An Object referring to any elementary or composite data type uses 4 bytes in addition to the data contained in the data type.
Тип данных дата windows
Типы данных Windows
Типы данных, поддерживаемые Microsoft ® Windows ® используются для определения возвращаемых значений функциями, параметров функций и сообщений и членов структур. Они определяют размер и значение этих элементов.
Нижеследующая таблица содержит такие перечисляемые типы, как: символ, целое число, Булево число, указатель и дескриптор. Типы символ, целое и Булево число являются стандартными для большинства трансляторов с языка C. Большинство названий типа указателя начинаются с префикса P или LP . Дескрипторы ссылаются на ресурс, который был загружен в память. Для получения дополнительной информации об обработке 64-разрядных целых чисел, см. Большие целые числа .
Описание
Атом. Дополнительную информацию смотри в статье Atoms (Атомы) . Этот тип объявлен в Windef.h как показано ниже:
Булева переменная (должна быть ИСТИНА (TRUE) или ЛОЖЬ (FALSE)). Этот тип объявлен в Windef.h как показано ниже:
Булева переменная (должна быть ИСТИНА (TRUE) или ЛОЖЬ (FALSE)). Этот тип объявлен в Winnt.h как показано ниже:
Байт (8 бит). Этот тип объявлен в Windef.h как показано ниже:
CALLBACK
Соглашение о вызовах для функций повторного вызова. Этот тип объявлен в Windef.h как показано ниже:
8-битовый символ Windows ( ANSI ). Дополнительную информацию смотри в статье Наборы символов, используемые шрифтами . Этот тип объявлен в Winnt.h как показано ниже:
COLORREF
Красный ( r ed), зеленый ( g reen), голубой ( b lue) (RGB) значение цвета (32 бита). За большей информацией об этом типе обратитесь к статье COLORREF . Этот тип объявлен в Windef.h как показано ниже:
Переменная, значение которой остается постоянным в ходе выполнения программы. Этот тип объявлен в Windef.h как показано ниже:
32-разрядное беззнаковое целое число. Этот тип объявлен в Windef.h как показано ниже:
DWORD_PTR
Тип беззнаковый дальний для точности указателя. Используется тогда, когда производится приведение указателя к дальнему типу, чтобы выполнить арифметические операции над указателями.( Также обычно используется для общих 32-разрядных параметров, которые были расширены до 64 битов в 64-разрядном Windows ).
Windows Data Types
The data types supported by Windows are used to define function return values, function and message parameters, and structure members. They define the size and meaning of these elements. For more information about the underlying C/C++ data types, see Data Type Ranges.
The following table contains the following types: character, integer, Boolean, pointer, and handle. The character, integer, and Boolean types are common to most C compilers. Most of the pointer-type names begin with a prefix of P or LP. Handles refer to a resource that has been loaded into memory.
For more information about handling 64-bit integers, see Large Integers.
Data type | Description | |
---|---|---|
APIENTRY | The calling convention for system functions. This type is declared in WinDef.h as follows: #define APIENTRY WINAPI | |
ATOM | An atom. For more information, see About Atom Tables. This type is declared in WinDef.h as follows: typedef WORD ATOM; | |
BOOL | A Boolean variable (should be TRUE or FALSE). This type is declared in WinDef.h as follows: typedef int BOOL; | |
BOOLEAN | A Boolean variable (should be TRUE or FALSE). This type is declared in WinNT.h as follows: typedef BYTE BOOLEAN; | |
BYTE | A byte (8 bits). This type is declared in WinDef.h as follows: typedef unsigned char BYTE; | |
CALLBACK | The calling convention for callback functions. This type is declared in WinDef.h as follows: #define CALLBACK __stdcall CALLBACK, WINAPI, and APIENTRY are all used to define functions with the __stdcall calling convention. Most functions in the Windows API are declared using WINAPI. You may wish to use CALLBACK for the callback functions that you implement to help identify the function as a callback function. | |
CCHAR | An 8-bit Windows (ANSI) character. This type is declared in WinNT.h as follows: typedef char CCHAR; | |
CHAR | An 8-bit Windows (ANSI) character. For more information, see Character Sets Used By Fonts. This type is declared in WinNT.h as follows: typedef char CHAR; | |
COLORREF | The red, green, blue (RGB) color value (32 bits). See COLORREF for information on this type. This type is declared in WinDef.h as follows: typedef DWORD COLORREF; | |
CONST | A variable whose value is to remain constant during execution. This type is declared in WinDef.h as follows: #define CONST const | |
DWORD | A 32-bit unsigned integer. The range is 0 through 4294967295 decimal. This type is declared in IntSafe.h as follows: typedef unsigned long DWORD; | |
DWORDLONG | A 64-bit unsigned integer. The range is 0 through 18446744073709551615 decimal. This type is declared in IntSafe.h as follows: typedef unsigned __int64 DWORDLONG; | |
DWORD_PTR | An unsigned long type for pointer precision. Use when casting a pointer to a long type to perform pointer arithmetic. (Also commonly used for general 32-bit parameters that have been extended to 64 bits in 64-bit Windows.) This type is declared in BaseTsd.h as follows: typedef ULONG_PTR DWORD_PTR; | |
DWORD32 | A 32-bit unsigned integer. This type is declared in BaseTsd.h as follows: typedef unsigned int DWORD32; | |
DWORD64 | A 64-bit unsigned integer. This type is declared in BaseTsd.h as follows: typedef unsigned __int64 DWORD64; | |
FLOAT | A floating-point variable. This type is declared in WinDef.h as follows: typedef float FLOAT; | |
HACCEL | A handle to an accelerator table. This type is declared in WinDef.h as follows: typedef HANDLE HACCEL; | |
HALF_PTR | Half the size of a pointer. Use within a structure that contains a pointer and two small fields. This type is declared in BaseTsd.h as follows:
| |
HANDLE | ||
POINTER_UNSIGNED | ||
SERVICE_STATUS_HANDLE |