🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #522

two declaration of malloc

#522
From: sja
Date: Sat, 21 Oct 1989 16:07
33 lines
1173 bytes
I am having trouble compiling following program
----------------
extern "C" {
#include <rpc/types.h>  
}
#include <String.h>
main()
{
 printf("done\n");
}
----------------
I get the msg:
make -k
	g++ -c   -I/usr/local/gnu/lib/g++-1.35.1.lib/g++-include  l.cc
/usr/local/gnu/lib/g++-1.35.1.lib/g++-include/std.h:119: conflicting types for `void *malloc (unsigned int)'
*** Error code 1
---------------

The problem is that  <rpc/types.h> has
       extern char* malloc(); => extern char* malloc(...)
This declaration conflicts with the
      void *malloc(unsigned int);

Is there a way to tell the compiler that both declarations refers to the
same malloc function ?
How is overload resolution done in g++ ?  I would appreciate any information
in this regard.

Thanks,

Jags
sja@cs.purdue.edu
Technical Details
Message-ID: <8910211607.AA26443@medusa.cs.purdue.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!philmtl!uunet!tut.cis.ohio-state.edu!CS.PURDUE.EDU!sja

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!philmtl!uunet!tut.cis.ohio-state.edu!CS.PURDUE.EDU!sja
From: sja@CS.PURDUE.EDU
Newsgroups: gnu.g++.bug
Subject: two declaration of malloc
Message-ID: <8910211607.AA26443@medusa.cs.purdue.edu>
Date: 21 Oct 89 16:07:28 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 33