Monday 15 September 2014

c++ - How does size_t and the __w64, time_t and __int64 work? -


I am not an elderly in C or C ++. I do not know how time_t is defined and Is designed. Many posts like:

  • But these posts only show that Time_t or size_t . It does not clearly tell where the time is defined and declared and the declared time_t or size is there.

    I am using WIN8 VS2012 Express C ++ . I searched the library and found that size_t to crtdefs.h instead of cstddef is defined.

    • Why do you need type like size_t , time_t ? We can return sizeof just unsigned int .
    • Why does not the C ++ Library define size_t
    • Can I say that size_t no is a C / C + Is the underlying type?
    • I have size_t or time_t in my code (perhaps defined in the std namespace).

      I searched again in the library and found size_t is defined as typedef _W64 unsigned int size_t , and _W64 is defined as __w64 . Here, I can not find more where __w64 is defined or declared.

      • What is the type of __w64 ? It has not been told in the C ++ 11 / C99 standard

        Similarly when I searched for time_t , I would like to see the __i int6 Found. But it does not know where from __ int64 comes from.

        A Microsoft specific extension that enables warnings when compiling with "/ wp64" - its Usage is used to identify "dangerous" code if you are trying to compile it for 64-bit - for example specifying a 64-bit value in 32-bit one Example: < Pre> size_t s; ... unsigned int i; ... i = s; // 32bit can not take all 64 bit values ​​- the probable problem is the definition of

        size_t and time_t is typedef. Size_t; and typedef ... time_t; - They are "not fixed" in the compiler Standards say that they have to be there (and the compiler targets to be suitable for the system). I think that you think that cstddef will contain some place or some other in crtdefs.h .

        This is a Microsoft compiler type. This compiler is defined by itself. It can then be used to define another "type of type", such as time_t or size_t (appropriate unsigned ) It may not be of this type in other compilers, but there will be some way of defining 8, 16, 32 and 64-bit integers. The actual origin of __ int64 is probably before the origin of longer , which was not supported by Microsoft for long time (micron intentions) I believe It is now.

No comments:

Post a Comment