🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50877

Mixing C and C++

#50877
From: Nuno Miguel Santos Silva [lugo]
Date: Thu, 22 Jul 1993 02:08
30 lines
1613 bytes
Hello, this is probably a FAQ, but any way, here goes:

  Is it possible to mix K&R C and C++ on the same file, so it compiles under
gcc 2.4.*?
  What I have in mind is something like this:

------------
  int f(P) int *P; { *P = 2; }

  class aClass { public: int X; };

  int main(int, char *[]) { aClass anObject; f(&anObject.X); return 0; }
------------

  I have been able to do this, but spliting C and C++ to different files;
however, I have a previous code that mixes both languages and it would be quite
hard to split it.

  All the help I may get will be appreciated... Thanks in advance.


PS - If possible, could you direct your answers (if any) to my email address: 
     nss@fct.unl.pt.

--
Nuno Santos Silva                 | BITNET/Internet: nss@fct.unl.pt
Universidade Nova de Lisboa       |
FCT - Dpto. de Informatica        | Fax:   (+351) (1) 295-5641
2825 Monte Caparica, PORTUGAL     | Phone: (+351) (1) 295-4464
Technical Details
Message-ID: <1993Jul22.020846.8750@fct.unl.pt>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!uunet!mcsun!news.inesc.pt!dec4pt.puug.pt!unl!nss

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,474e461db106c9b3,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-07-22 02:22:28 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!uunet!mcsun!news.inesc.pt!dec4pt.puug.pt!unl!nss
From: nss@fct.unl.pt (Nuno Miguel Santos Silva [lugo])
Subject: Mixing C and C++
Message-ID: <1993Jul22.020846.8750@fct.unl.pt>
Sender: news@fct.unl.pt (USENET News System)
Organization: Universidade Nova de Lisboa, PORTUGAL
X-Newsreader: TIN [version 1.2 PL0]
Date: Thu, 22 Jul 1993 02:08:46 GMT
Lines: 30