is size_t a keyword or a macro defination?

G

Guo Congbin

·¢¼þÈË: "Guo Congbin" <[email protected]>
Ö÷Ìâ: 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(__cplusplus)
#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

P.J. Plauger

·¢¼þÈË: "Guo Congbin" <[email protected]>
Ö÷Ìâ: 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(__cplusplus)
#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.

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

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
 
P

Pete Becker

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

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.
 
I

Ioannis Vranos

Guo said:
·¢¼þÈË: "Guo Congbin" <[email protected]>
Ö÷Ìâ: 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(__cplusplus)
#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



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






Best regards,

Ioannis Vranos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top