*BSD News Article 77773


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!hunter.premier.net!www.nntp.primenet.com!nntp.primenet.com!howland.erols.net!vixen.cso.uiuc.edu!milo.mcs.anl.gov!maverick.mcs.anl.gov!balay
From: balay@maverick.mcs.anl.gov (Satish Balay)
Newsgroups: comp.unix.bsd.freebsd.misc,gnu.g++.help
Subject: Re: g++2.7.2 error on freebsd
Date: Sun, 8 Sep 1996 15:7:17 GMT
Organization: MCS, Argonne National Laboratory
Lines: 64
Distribution: world
Message-ID: <84219523715529@maverick.mcs.anl.gov>
References: <8414360547401@maverick.mcs.anl.gov> <50ee1f$dp@anorak.coverform.lan> <50t8s1$lhr@news1.infinet.com>
NNTP-Posting-Host: maverick.mcs.anl.gov
Cc: ao@infinet.com
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:26832 gnu.g++.help:13246

In article <50t8s1$lhr@news1.infinet.com>, Mike Harrold <ao@infinet.com> wrote:
>Brian Somers (brian@awfulhak.demon.co.uk) wrote:
>
>I have simpler questions... why is he using FILEs? Why is he using C header
>files (eg <stdlib.h>) and not C++ header files (eg <cstdlib>)?

I'm working on a project which involves developing numerical 
libraries. We do the coding in "c", and provide stubs for
it to be useable from C++ and fortran. Since most of
"c" compiles in "c++", the stubbs of "c++" are provided
using #define, and by compiling with c++ compiler.
Since c++ compiler is supporsed to work with stdio.h, stdlib.h, we use them.
Till now we did'nt whave any problems with this. We were using 
eariler versions of gcc/g++ (On various platforms like sun4, 
LINUX, freebsd, DEC alpha It also works on other platforms
like IRIX, IBM rs6000, solaris etc... whre we use native
c , c++ compilers.). But on freebsd using g++2.7.2, we get this strange
warinig message, which dos'nt occur on ANY OTHER PRATFORM (other compilers,
older versions of g++, g++2.7.2 on sun4, LINUX, DEC alpha). This
kinad of sugests that either g++-2.7.2 on freebsd is screwed up,
or they implemented a new feature of C++ not implemneted on g++2.7.2
on other arch. In either case, how do i get rid of this warning message?


The code i posted was just a cut out form this project. I added a few
things ( Like the FILE stuff) so that it compiles standalone.
I have a new cut without the FILE stuff which gives the same warnings.

Thanks for the help.

Satish

----------
#include <stdio.h>
#include <stdarg.h>


int NewPrintf(char *format,...)
{
  int rank;
  va_list Argp;

  va_start( Argp, format );
  vfprintf(stdout,format,Argp); 
  va_end( Argp );
  fflush(stdout);
  return 0;
}


int main ()
{
  int a=10, b=20,c=30;
  NewPrintf( "A = %d B = %d C = %d\n",a,b,c);
  return 0;
} 
------------------
elvis:/home/balay/junk>!g++
g++ printf.c
printf.c: In function `int NewPrintf(char * ...)':
printf.c:11: warning: ANSI C++ forbids implicit conversion from `void *' in argument passing
elvis:/home/balay/junk>a.out
A = 10 B = 20 C = 30
-------------------