is size_t a keyword or a macro defination?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Guo Congbin

    is size_t a keyword or a macro defination?


    ·¢¼þÈË: "Guo Congbin" <guocongbin@sei .buaa.edu.cn>
    Ö÷Ìâ: is size_t a keyword?or a macro?
    ÈÕÆÚ: 2004Äê6ÔÂ17ÈÕ 23:04

    if size_t is a macro, where is the defination? i look it up in the stddef.h,
    but i find nothing about size_t.

    this is the content of stddef.h of my system,
    #ifndef _LINUX_STDDEF_H
    #define _LINUX_STDDEF_H

    #undef NULL
    #if defined(__cplus plus)
    #define NULL 0
    #else
    #define NULL ((void *)0)
    #endif

    #undef offsetof
    #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)

    #endif

    i regard the size_t as unsigned int or unsigned long, and i am not very
    confidence.

    Please help me!

    yours Guocongbin
    2004.6.17



  • P.J. Plauger

    #2
    Re: is size_t a keyword or a macro defination?

    "Guo Congbin" <guocongbin@sei .buaa.edu.cn> wrote in message
    news:casca7$raj $1@mail.cn99.co m...
    [color=blue]
    > ·¢¼þÈË: "Guo Congbin" <guocongbin@sei .buaa.edu.cn>
    > Ö÷Ìâ: is size_t a keyword?or a macro?
    > ÈÕÆÚ: 2004Äê6ÔÂ17ÈÕ 23:04
    >
    > if size_t is a macro, where is the defination? i look it up in the[/color]
    stddef.h,[color=blue]
    > but i find nothing about size_t.
    >
    > this is the content of stddef.h of my system,
    > #ifndef _LINUX_STDDEF_H
    > #define _LINUX_STDDEF_H
    >
    > #undef NULL
    > #if defined(__cplus plus)
    > #define NULL 0
    > #else
    > #define NULL ((void *)0)
    > #endif
    >
    > #undef offsetof
    > #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
    >
    > #endif
    >
    > i regard the size_t as unsigned int or unsigned long, and i am not very
    > confidence.[/color]

    size_t *should* be defined in <stddef.h>, and several other headers,
    as a type (with a typedef).

    P.J. Plauger
    Dinkumware, Ltd.



    Comment

    • Pete Becker

      #3
      Re: is size_t a keyword or a macro defination?

      Guo Congbin wrote:[color=blue]
      >
      > this is the content of stddef.h of my system,
      > #ifndef _LINUX_STDDEF_H
      > #define _LINUX_STDDEF_H
      >[/color]

      That's an internal header, used, I think, when building the Linux
      kernel. Look for the stddef.h that comes with your compiler. On my Linux
      system it's in /usr/lib/gcc-lib/i386-redhat-linux/2.96/include.

      --

      Pete Becker
      Dinkumware, Ltd. (http://www.dinkumware.com)

      Comment

      • Ioannis Vranos

        #4
        Re: is size_t a keyword or a macro defination?

        Guo Congbin wrote:
        [color=blue]
        > ·¢¼þÈË: "Guo Congbin" <guocongbin@sei .buaa.edu.cn>
        > Ö÷Ìâ: is size_t a keyword?or a macro?
        > ÈÕÆÚ: 2004Äê6ÔÂ17ÈÕ 23:04
        >
        > if size_t is a macro, where is the defination? i look it up in the stddef.h,
        > but i find nothing about size_t.
        >
        > this is the content of stddef.h of my system,
        > #ifndef _LINUX_STDDEF_H
        > #define _LINUX_STDDEF_H
        >
        > #undef NULL
        > #if defined(__cplus plus)
        > #define NULL 0
        > #else
        > #define NULL ((void *)0)
        > #endif
        >
        > #undef offsetof
        > #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
        >
        > #endif
        >
        > i regard the size_t as unsigned int or unsigned long, and i am not very
        > confidence.
        >
        > Please help me!
        >
        > yours Guocongbin
        > 2004.6.17
        >
        >
        >[/color]



        In C++ size_t is a typedef of a built in unsigned integral type defined
        in <cstddef>.






        Best regards,

        Ioannis Vranos

        Comment

        • Ioannis Vranos

          #5
          Re: is size_t a keyword or a macro defination?

          Ioannis Vranos wrote:
          [color=blue]
          > In C++ size_t is a typedef of a built in unsigned integral type[/color]

          and is
          [color=blue]
          > defined
          > in <cstddef>.[/color]






          Best regards,

          Ioannis Vranos

          Comment

          Working...