delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/02/09:00:05

Path: news.mv.net!news-out.cwix.com!newsfeed.cwix.com!newsfeed.icl.net!colt.net!diablo.theplanet.net!news.theplanet.net!newspost.theplanet.net!not-for-mail
From: Jason Green <mail AT jgreen4 DOT fsnet DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ok, I have more info on problem at hand
Date: Sat, 02 Sep 2000 12:31:43 +0100
Organization: Customer of Energis Squared
Lines: 43
Message-ID: <hsn1rs04jjeiksk1saev2cfjv5fpafqp1f@4ax.com>
References: <Mtg9LD_00Uw9QI9Fw3 AT andrew DOT cmu DOT edu>
NNTP-Posting-Host: modem-81.chlorine.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: news8.svr.pol.co.uk 967894342 13722 62.136.16.81 (2 Sep 2000 11:32:22 GMT)
NNTP-Posting-Date: 2 Sep 2000 11:32:22 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Agent 1.7/32.534
Xref: news.mv.net comp.os.msdos.djgpp:103081

James W Sager Iii <sager+@andrew.cmu.edu> wrote:

> Either way, malloc and remalloc are no longer working with this updated
> version of c/c++

So is this a C program, or C++.  This is important to know because
what you are trying to do is legal in C but not legal in C++.

> Here is my code:
> 
> int *i;
> i=malloc(20);
> i=realloc(100);

i=realloc(i, 100);

> errors:
>  Error: ANSI C++ forbids implicit conversion from `void *' in assignment
>  Error: ANSI C++ forbids implicit conversion from `void *' in assignment
> 
> 
> These errors are really messing my day up.  I was able to work around
> them elsewhere but they nailed me here.  

Rather than trawl through your code and fixup all these problems, you
could compile with the -fpermissive switch, then gcc should behave
much like it used to.

> Ideas on what causes this would be muchly appreciated.

The error message says it all.  You cannot implicitly cast the void
ptr return from malloc() to a int ptr.  If this is a C++ program you
should use new/delete rather than malloc()/free().  If this is a C
program we need to see the command line you used to compile to tell
why it is being compiled as C++ code.

> I want to compile my old game project properly before I try compiling
> crystal space 3d so I don't ask lots of pathetic questions about why I
> can't get it to compile on their newsgroup that are based in the fact
> that my compiler doesn't work.

DJGPP *does* work.  The problems you have are due to the fact that gcc
conforms to ANSI/ISO standard, whereas your old game project does not.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019