This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: sizeof() return type ?
- From: Ian Lance Taylor <iant at google dot com>
- To: Darryl Miles <darryl-mailinglists at netbauds dot net>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 22 Jun 2006 13:06:54 -0700
- Subject: Re: sizeof() return type ?
- References: <449AF3FF.8070503@netbauds.net>
Darryl Miles <darryl-mailinglists@netbauds.net> writes:
> This one is taxing me, what is the correct type returned by the built
> in sizeof() operator ?
>
> int ?
> unsigned int ?
> size_t ?
> ssize_t ?
This is a general C question, not a gcc question. As such, it should
probably go to a mailing list about C, not to a mailing list
specifically about gcc. Thanks.
The answer is that sizeof returns a value of type size_t.
> Where does size_t and ssize_t originate from ? ANSI/stdio ?
I believe size_t was introduced in the ISO C90 standard. I believe
that ssize_t was introduced in the second edition of the POSIX 1003.1
standard (1003.1-1996).
Ian