Article View: comp.sys.amiga.tech
Article #4841malloc under Lattice C V5.05
From: Bruce Albrecht
Date: Sun, 12 Aug 1990 08:25
Date: Sun, 12 Aug 1990 08:25
19 lines
1359 bytes
1359 bytes
According to the errata sheet, malloc is type (void *), and that it should
not be necessary to put a cast in front of the return value. However, when
I had defined the following fragment:
char *outname;
outname = malloc(SomeConstant);
the compiler gave me a warning that the malloc was not the same type as
outname, and I had to change it to (char *) malloc to get rid of the warning.
Am I misunderstanding something, or is the errata sheet wrong, or is there
something wrong with Lattice C (either in the include or compiler)?
Also, do I need to explicitly free any memory allocated by malloc before
the program exits, or does it get freed automatically? It looks to me as
though it is freed when the program terminates.
UUCP: {amdahl!bungia, uunet!rosevax, crash}!orbit!pnet51!bga
ARPA: crash!orbit!pnet51!bga@nosc.mil
INET: bga@pnet51.orb.mn.org
Technical Details
Message-ID:
<3034@orbit.cts.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!zaphod.mps.ohio-state.edu!swrinde!ucsd!helios.ee.lbl.gov!nosc!crash!orbit!pnet51!bgaShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!zaphod.mps.ohio-state.edu!swrinde!ucsd!helios.ee.lbl.gov!nosc!crash!orbit!pnet51!bga From: bga@pnet51.orb.mn.org (Bruce Albrecht) Newsgroups: comp.sys.amiga.tech Subject: malloc under Lattice C V5.05 Message-ID: <3034@orbit.cts.com> Date: 12 Aug 90 08:25:03 GMT Sender: root@orbit.cts.com Organization: People-Net [pnet51], Minneapolis, MN. Lines: 19 X-Local-Date: 12 Aug 90 01:25:03 PDT