473,699 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

is size_t a keyword or a macro defination?


·¢¼þÈË: "Guo Congbin" <gu********@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

Jul 22 '05 #1
4 3039
"Guo Congbin" <gu********@sei .buaa.edu.cn> wrote in message
news:ca******** **@mail.cn99.co m...
·¢¼þÈË: "Guo Congbin" <gu********@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.


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
Jul 22 '05 #2
Guo Congbin wrote:

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.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Jul 22 '05 #3
Guo Congbin wrote:
·¢¼þÈË: "Guo Congbin" <gu********@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


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


Best regards,

Ioannis Vranos
Jul 22 '05 #4
Ioannis Vranos wrote:
In C++ size_t is a typedef of a built in unsigned integral type
and is
defined
in <cstddef>.



Best regards,

Ioannis Vranos
Jul 22 '05 #5

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

Similar topics

2
2350
by: Guo Congbin | last post by:
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
7
23548
by: Newbie_sw2003 | last post by:
Where should I use them? I am giving you my understandings. Please correct me if I am wrong: MACRO: e.g.:#define ref-name 99 The code is substituted by the MACRO ref-name. So no overhead. Execution is faster. Where will it be stotred?(Is it in bss/stack/?) FUNCTION:
11
19510
by: javadesigner | last post by:
Hi: I am a bit new to C programming and am trying to write a wrapper around malloc. Since malloc takes size_t as it's parameter, I want to be able to see if my function recieved an argument less than or equal to the max size_t type. So:
16
6132
by: Xenos | last post by:
Is there a standard way to determine the max. value of size_t as a compile-time constant? Will: #define SIZE_T_MAX ((size_t) -1) work in all cases, or just on 2s comp. machines? DrX
5
16602
by: siliconwafer | last post by:
Hi all, I wanted to know that is use of extern keyword mandatory in case of global variables and functions used in other source files? i.e consider a following piece of code from MSDN explaining extern storage class: /****************************************************************** SOURCE FILE ONE *******************************************************************/ extern int i; /* Reference to i, defined below */
17
7083
by: sounak | last post by:
How could we get a macro name from a macro value such that in a header file #define a 100 #define b 200 now the source file will be such that the user gives 100 then the value is outputted as a the user gives 200 then the value is outputted as b
8
4786
by: Morgan | last post by:
Hi all, I was messing around with someone elses script when I noticed that he had used the in keyword in an if conditional to compare a string with a object. I've never seen this used and was wondering about the logic behind it. I had previously assumed that the in keyword passed the properties of an object to a variable, as you do in a for/in loop. How is it that it can be used in a comparsion? example:
13
1562
by: sam_cit | last post by:
Hi Everyone, I was looking at the function prototype of malloc() function in stdlib.h and i found that to be, void *malloc(size_t size); so what is size_t is it a pre-defined typedef to int? Thanks in advance.
22
27054
by: subramanian100in | last post by:
Consider the following program #include <limits.h> #include <stddef.h> int main(void) { size_t size; size_t bytes = sizeof(size_t);
0
8615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9173
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8911
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7748
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5872
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.