Re: Identifying types in C- or pascal-like type systems

James Jones <jejones@microware.com>
18 Dec 2000 00:35:52 -0500

          From comp.compilers

Related articles
Identifying types in C- or pascal-like type systems psyupjc@nottingham.ac.uk (Peter James Cowderoy) (2000-12-13)
Re: Identifying types in C- or pascal-like type systems jejones@microware.com (James Jones) (2000-12-18)
Re: Identifying types in C- or pascal-like type systems smoleski@surakware.com (Sebastian Moleski) (2000-12-18)
Re: Identifying types in C- or pascal-like type systems schelian@bu.edu (Suhas Chelian) (2000-12-18)
| List of all articles for this month |

From: James Jones <jejones@microware.com>
Newsgroups: comp.compilers
Date: 18 Dec 2000 00:35:52 -0500
Organization: Microware Systems Corporation
References: 00-12-053
Keywords: types, C, C++
Posted-Date: 18 Dec 2000 00:35:52 EST

As the moderator points out, C++ is definitely more complicated.
ANSI C is in turn more complicated than K&R, by virtue of


1. type qualifiers (two so far; aside from "function returning,"
      any base type or type modifier may or may not have any of them)


2. function prototypes (so you actually have to remember the number
      and types of the arguments, but "old style" is still grandfathered
      in, so that has to be accounted for as well)


In the "old days," the signature (dmr-originated, as far as I know)
for types (base type code in the least significant hunk, with two
bits per type modifier (none, array of, pointer to, function
returning) tacked on in successively more significant pieces) was
unique (to the extent that the compilers cared, at least... :-).
It's still useful as a quick check (equality of signature is
necessary for type compatibility, but not sufficient).


James Jones


Peter James Cowderoy wrote:
>
> What methods do people use for storing the type of a variable or
> expression with C-like type systems? Does this change any further when
> you incorporate the likes of C++'s templates?





Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.