Re: Supporting byte-addressability on word-addressed hardware

tl@ae.chalmers.se (Torbj|rn Lindgren)
Wed, 12 Jul 1995 15:43:39 GMT

          From comp.compilers

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)
| List of all articles for this month |
Newsgroups: gnu.gcc.help,comp.compilers
From: tl@ae.chalmers.se (Torbj|rn Lindgren)
Keywords: GCC, architecture
Organization: Dept. of Applied Electronics, Chalmers Univ. of Technology
References: 95-06-081 95-07-054
Date: Wed, 12 Jul 1995 15:43:39 GMT

David Keppel <pardo@cs.washington.edu> wrote:
>>[Pointer representations for GNU CC]
[...]
> 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.


Note that this code is perfectly correct if free is correctly declared
previously. I don't have a copy of K&R II at hand, so I can't check
which include-file free is supposed to declared in, but a quick check
on two machines indicates that it's probably stdlib.h.


In short, this isn't such a big problem problem as you are making
it. Especially since a lot of compilers can warn you about undeclared
functions!


Gcc warns you about this if you uses -Wall, and it was gcc he was
porting...


--


Post a followup to this message

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