size_t. A basic unsigned integer C/C++ type. It is the type of the result returned by sizeof operator. The type's size is chosen so that it could store the maximum size of a theoretically possible array of any type. On a 32-bit system size_t will take 32 bits and on a -bit one - bits. In other words, a pointer can be safely put inside size_t type (an exception is class-function-pointers but this is a special case). size_t type is usually used for loop, array indexing, size storage and . Although size_t can store a pointer, it is better to use another unsinged integer type for that purpose (its name reflects its capability). In some cases using size_t type is more effective and safe than using a more habitual for the programmer unsigned type.
size_t is a base unsigned integer memsize-type defined in the standard library of C/C++ languages. This type is described in the header file stddef.h for C and in the file cstddef for C++. Types defined by the header file stddef.h are located in the global namespace while cstddef places the size_t type in the namespace std. Since the standard header file stddef.h of the C language is included into C++ programs for the purpose of compatibility, in these programs you may address the type both in the global namespace (::size_t, size_t) and namespace std (std::size_t).
In the terms of static analyzer , type size_t refers to -types. The analyzer includes system for detailed error detection in programs and for code optimization. Many diagnostic messages shown by Viva analyzer relate to recommendations on using memsize-types. Using memsize-types (such as size_t, ptrdiff_t, INT_PTR) instead of 32-bit types in -bit programs allows you to:
To learn more about the errors you can avoid when using size_t type and also how this type allows improving and optimizing your -bit programs, see the articles given in the references.
If you are planning to start developing -bit projects or porting the existing 32-bit projects on -bit systems, we would like to offer you purchasing analyzer which will simplify this task greatly and allow you to avoid the long period of searching hidden errors.
http://www.viva.com/en/t/0044/因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- niushuan.com 版权所有 赣ICP备2024042780号-2
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务