Related articles |
---|
Supporting byte-addressability on word-addressed hardware lehotsky@tiac.net (1995-06-27) |
Re: Supporting byte-addressability on word-addressed hardware simmons@bnr.ca (steve (s.s.) simmons) (1995-06-28) |
Re: Supporting byte-addressability on word-addressed hardware markt@harlequin.co.uk (1995-07-04) |
Re: Supporting byte-addressability on word-addressed hardware pardo@cs.washington.edu (1995-07-05) |
Re: Supporting byte-addressability on word-addressed hardware bob@tera.com (1995-07-06) |
Re: Supporting byte-addressability on word-addressed hardware mfx@cs.tu-berlin.de (1995-07-06) |
Re: Supporting byte-addressability on word-addressed hardware tl@ae.chalmers.se (1995-07-12) |
Re: Supporting byte-addressability on word-addressed hardware pardo@cs.washington.edu (1995-07-19) |
Re: Supporting byte-addressability on word-addressed hardware meissner@cygnus.com (Michael Meissner) (1995-07-20) |
Newsgroups: | gnu.gcc.help,comp.compilers |
From: | pardo@cs.washington.edu (David Keppel) |
Keywords: | GCC, architecture |
Organization: | Computer Science & Engineering, U. of Washington, Seattle |
References: | 95-06-081 95-07-018 |
Date: | Wed, 5 Jul 1995 17:23:18 GMT |
>[Pointer representations for GNU CC]
There are a variety of C compilers that use more than one pointer
format. For example, the DEC-20 KCC-20 used *four* pointer formats.
Multiple pointer formats can lead to problems with some C code that is
nonportable, but common nonetheless. For example, the following code
is nonportable and fails:
int *p = malloc (sizeof(int));
free (p);
The correct solution is to cast `p' to a `char *' before passing it to
`free'. However, you might be unwilling to do this (or force your
users to do this) and failing to use the casts can lead to mysterious
failures. Your call.
FWIW, a number of such issues are discussed in the `Portability'
section of ``Recommended C Style and Coding Standards'' by a long list
of authors including me. The document is available via WWW URL,
anonymous ftp, and printed on paper
http://www.cs.washington.edu/homes/pardo/papers.d/cstyle.html
ftp://ftp.cs.washington.edu/pub/pardo/cstyle.ps.Z
ftp://ftp.cs.washington.edu/pub/cstyle.tar.Z (source)
sales@ssc.com (paper)
Grungier details, such as the pointer format stuff is discussed in the
troff source comments (sorry!).
;-D on ( Answers to questions you didn't think you asked ) Pardo
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.