C strongly typed?

Farrell Woods ftw at quasar..westford.ccur.com
Sat Mar 10 10:41:15 AEST 1990


In article <25F6E8B7.16437 at paris.ics.uci.edu> bvickers at ics.uci.edu (Brett J. Vickers) writes:
>ftw at quasar.westford.ccur.com, I write:
>>...The point is that `char' and `int' (and, `short' and `long')
>>all describe *integer* quantities....

>If C were as strongly typed a language as Ada (or Pascal) is, it
>would not allow integers to be accessed and stored as char types.

You're missing the point: C doesn't have a `char' type in the same sense
as Pascal, et. al.  It has integers that can hold greater or lesser ranges
of values, depending on your needs (you describe your need by declaring an
appropriately sized variable).  For instance: 'c' has type `int'.  Really.
Try this:

main()
    {
    printf("%d\n", sizeof ('c'));
    }

and tell us what your compiler says.  It *should* give an answer that is
the same as sizeof (int).

	-- Farrell Woods

--
Farrell T. Woods				Voice:  (508) 392-2471
Concurrent Computer Corporation			Domain: ftw at westford.ccur.com
1 Technology Way				uucp:   {backbones}!masscomp!ftw
Westford, MA 01886				"I can't drive...fifty-five!"



More information about the Comp.lang.c mailing list