Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.std.c, comp.lang.c |
| Subject | Re: Types in C |
| Date | 2011-05-22 12:48 -0700 |
| Organization | None to speak of |
| Message-ID | <ln8vtyzfcd.fsf@nuthaus.mib.org> (permalink) |
| References | <irbo6c$ul$1@speranza.aioe.org> |
Cross-posted to 2 groups.
jacob navia <jacob@spamsink.net> writes:
> I am updating my tutorial of C, and I have added a section of type
> classification. Please tell me if I forgot something or said
> something wrong if possible.
>
> Thanks in advance for your help
>
>
> A C type can be either a function type, an incomplete type or an object
> type. Function types can be either fully specified, i.e. we have a
> prototype available, or partially specified with missing arguments but
> a known return value. The function type "implicit int function" with
> return value and arguments unknown, has been declared obsolete in C99.
In C90, "implicit int function" isn't a distinct type.
foo(void);
and
int foo(void);
are merely two different ways of expressing exactly the same thing.
The return type isn't unknown, it's int.
> Incomplete types are unspecified and it is assumed that they will be
> specified elsewhere, except for the void type that is an incomplete
> type that can't be further specified.
>
> Object types can be either scalar or composite types. Composite types
> are built from the scalar types: structures, unions and arrays. Scalar
> types are of two kinds: arithmetic or pointer types. Pointer types can
> point to scalar or composite types, to functions or to incomplete types.
The phrase "composite type" has a very different meaning; see C99 6.2.7.
The standard refers to array and structure types (but not union types)
as "aggregate types". It doesn't seem to have a term that covers
arrays, structures and unions (and I'd be very hesitant in this kind of
tutorial to invent terms that aren't in the standard).
> Arithmetic types have two kinds: integer types and floating types. The
> integer types are either standard integers, bit fields or enumerations.
>
> The standard integer types are boolean, char, short, int, long and long
> long, all with signed or unsigned types, except the boolean type
> that hasn't any sign but is not an unsigned type.
You didn't mention extended integer types. I don't know whether you
want to.
> Floating types are either real or complex, with both of them appearing
> in three flavors: float, double and long double.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.std.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Types in C jacob navia <jacob@spamsink.net> - 2011-05-22 21:29 +0200
Re: Types in C Keith Thompson <kst-u@mib.org> - 2011-05-22 12:48 -0700
Re: Types in C Marcin Grzegorczyk <mgrzegor@poczta.onet.pl> - 2011-05-30 22:42 +0200
Re: Types in C Shao Miller <sha0.miller@gmail.com> - 2011-05-30 17:45 -0500
Re: Types in C Keith Thompson <kst-u@mib.org> - 2011-05-31 08:47 -0700
Re: Types in C Shao Miller <sha0.miller@gmail.com> - 2011-05-31 13:54 -0400
Re: Types in C Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-31 22:38 -0700
Re: Types in C Shao Miller <sha0.miller@gmail.com> - 2011-06-01 07:22 -0500
Re: Types in C Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-01 12:13 -0700
Re: Types in C jacob navia <jacob@spamsink.net> - 2011-05-31 00:16 +0200
Re: Types in C Shao Miller <sha0.miller@gmail.com> - 2011-05-30 18:30 -0500
Re: Types in C Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-31 22:43 -0700
Re: Types in C Shao Miller <sha0.miller@gmail.com> - 2011-06-01 07:41 -0500
Re: Types in C Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-01 12:23 -0700
Re: Types in C Marcin Grzegorczyk <mgrzegor@poczta.onet.pl> - 2011-06-02 22:44 +0200
Re: Types in C jacob navia <jacob@spamsink.net> - 2011-06-02 22:49 +0200
Re: Types in C Keith Thompson <kst-u@mib.org> - 2011-06-02 15:26 -0700
csiph-web