*BSD News Article 77768


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!news.sdsmt.edu!news.mid.net!news.dra.com!netaxs.com!news1.erols.com!howland.erols.net!vixen.cso.uiuc.edu!usenet
From: Vlad <vlad@uiuc.edu>
Newsgroups: comp.unix.bsd.freebsd.misc,gnu.g++.help
Subject: Re: g++2.7.2 error on freebsd
Date: Sun, 08 Sep 1996 14:37:33 -0500
Organization: Baphomet's Throne
Lines: 35
Message-ID: <3233207D.2781E494@uiuc.edu>
References: <8414360547401@maverick.mcs.anl.gov> <50ckcq$a0q@nntp.ucs.ubc.ca>
NNTP-Posting-Host: colt-29.slip.uiuc.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; I; FreeBSD 2.1.5-RELEASE i386)
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:26841 gnu.g++.help:13249

L. Felawka wrote:
> 
>  In article <8414360547401@maverick.mcs.anl.gov> balay@maverick.mcs.anl.gov (Satish Balay) writes:
>  >
>  >Hi,
>  >
>  >        I tried to compile this code on freebsd, and it dos'nt compile..
>  >        What am I doing wrong? I'm using g++ -v 2.7.2
> 
> It works for me, but gives compiler warning:
> 
>   foo.cc: In function `int NewPrintf(char * ...)':
>   foo.cc:14: warning: ANSI C++ forbids implicit conversion from `void *'
>              in argument passing
> 
> I am using gcc-2.7.2 (with "repo-bsd" and "no-weak-support" patches
> applied) and libg++-2.7.1 (compiled with gcc-2.7.2, of course).

	The problem seems to be in how the type of va_list is defined. It was
char* in v2.6.3 I believe but ends up void* in v2.7.2 when installed on
FreeBSD. You could fix it either in the appropriate .h-file or by coding
something like

#if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
  vsprintf (fmt, (char *)ap);
#else
  vsprintf (buf, fmt, ap);
#endif 

to be able to go between v2.6.3 and v2.7.2 at will. However, I noticed
that v2.7.2 installed on, say, OSF/1 v3.2 has no problems with va_list,
so maybe you should also check whether you're compiling on FreeBSD or
not in the first #if ...

Vlad.