473,242 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

size_t, size_type, unsigned

Who can tell the difference in detail?

Sep 16 '06 #1
2 4328
asdf wrote:
Who can tell the difference in detail?
Your environment's headers?

Ian Collins.
Sep 16 '06 #2
asdf wrote:
Who can tell the difference in detail?
size_t is the type of the value returned by sizeof(). It is also a
typedef in some standard headers.

size_type is another typedef used for example in the standard
containers, like std::vector and std::string.

unsigned is a standard type that is built into the compiler. As such,
it is available immediately, without any typedefs.
On some systems, size_t, size_type, and unsigned could all be the same
type. On other systems they might be different. By always using the
proper type, your code has a bigger chance of being portable from one
system to another.

Bo Persson
Sep 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Christopher | last post by:
can someone refresh my meory on what std::size_t is used for? I am wondering if my template container class should have it's capacity as a size_t or an int? , Christopher
by: Alex J. Dam | last post by:
Hi, which guidelines should be used about those integer types defined in the C++ Standard Library, like string::size_type, istream::pos_type, etc.? Are they meant to be used only in the library...
by: Grumble | last post by:
What is the difference between size_t and vector<T>::size_type? Are they ever a different type or a different size? Why should one type the latter when the former is shorter? What about the...
by: tings | last post by:
for (int i=0;i < strlen(pathcmd);i++){//this line cause a warning warning C4018: '<' : signed/unsigned mismatch strlen returns a number of type 'size_t'. size_t is an unsigned type and you are...
by: William Xuuu | last post by:
Hi, This's a way of defining size_t and ssize_t in Linux: //"linux/types.h" typedef __kernel_size_t size_t; typedef __kernel_ssize_t ssize_t; //"asm/posix_types.h" typedef unsigned...
by: wenjie | last post by:
there are many examples write the loop like this: vector<intcoll; for(int i = 0; i < coll.size(); ++i){ ... } the function size() return type is size_t (unsigned int) ; I think if the size...
by: Jess | last post by:
Hello, I think any specialized size_type, such as string::size_type and vector<T>::size_type, is defined in terms of size_t, which is much more low level. Since they are more or less...
by: mike3 | last post by:
Hi. I can't believe I may have to use an array here. I've got this bignum package I was making in C++ for a fractal generator, and tried an approach that was suggested to me here a while...
by: Lambda | last post by:
I'm writing a function to partition a vector according to a predicate. For example: vector<string>::size_type partition(vector<Student_info&v) { vector<string>::size_type i, j; i = -1; j =...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.