🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.help
Article #843

Re: Problems #including K&R function prototypes from C++

#843
From: Dietmar Kuehl
Date: Tue, 28 Nov 1995 01:40
32 lines
1522 bytes
Hi,
Max Welton (maxw@lmsc.lockheed.com) wrote:
: shekar@gizmo.cs.msstate.edu (Shekar Ramanathan) wrote:
: >What you should do is have another file called foo.c and compile it using
: >a K&R C compiler.  In main.C, you should just include a prototype declaration
: >for foo and finally link them together.
[...]
: I have the same problem with or without the 'extern"C"'. In the 
: real-world case, "foo.h" is a 3rd-party vendor header. We're just 
: not in a position to rewrite our favorite vendor's K&R headers.

You might try 'protoize' which is part of gcc. Here is a file I tried
it on:

  int foo(boo, ba)
     int boo, ba;
  {
     return boo + ba;   
  }

.. and here is what 'protoize' generated:

  int foo(int boo, int ba)
  {
     return boo + ba;   
  }

There is also a program called 'unprotoize'.
--
dietmar.kuehl@uni-konstanz.de
http://www.informatik.uni-konstanz.de/~kuehl
I am a realistic optimist - that's why I appear to be slightly pessimistic
Technical Details
Message-ID: <49dpat$4nu@eurybia.rz.uni-konstanz.de>
Path: arc1-ca.pugleaf.net!news.uni-konstanz.de!uzwil!kuehl
References: <49dk3d$s46@butch.lmsc.lockheed.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.uni-konstanz.de!uzwil!kuehl
From: kuehl@uzwil (Dietmar Kuehl)
Newsgroups: gnu.g++.help,comp.lang.c++
Subject: Re: Problems #including K&R function prototypes from C++
Date: 28 Nov 1995 01:40:45 GMT
Organization: Fakultät für Mathematik und Informatik
Distribution: world
Message-ID: <49dpat$4nu@eurybia.rz.uni-konstanz.de>
References: <49dk3d$s46@butch.lmsc.lockheed.com>
Reply-To: dietmar.kuehl@uni-konstanz.de
NNTP-Posting-Host: uzwil.informatik.uni-konstanz.de
X-Newsreader: TIN [version 1.1 PL6]