delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/25/11:14:59

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C++, fonts and Allegro
Date: Tue, 25 Apr 2000 14:26:07 GMT
Organization: always disorganized
Lines: 25
Message-ID: <3905aaec.22444643@news.freeserve.net>
References: <8dfmoo$1ga6$1 AT gavrilo DOT mtu DOT ru> <38fb861d DOT 46140079 AT news DOT freeserve DOT net> <432bgs0gehb8vrjd9ealhemeipdhl3dih9 AT 4ax DOT com>
NNTP-Posting-Host: modem-90.oklahoma.dialup.pol.co.uk
X-Trace: news8.svr.pol.co.uk 956672768 23140 62.137.87.90 (25 Apr 2000 14:26:08 GMT)
NNTP-Posting-Date: 25 Apr 2000 14:26:08 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Chris Mears wrote:

>>IMHO it's bad practice to write C that won't compile as C++,
>>but it's certainly possible.
>
>What?  Pick a language, and stick with it.  C is *not* C++.

But it takes very little effort to ensure that a C program compiles
as C++.  Really it's just a question of including a few typecasts
and avoiding giving your variables and functions names like "class",
"public", "private", "new" or "delete".  I'm not saying that there
aren't other incompatibilities, just that I haven't seen them in
practice.

The typecasts probably ought to be included for clarity anyway,
and C++ reserved words are surely best avoided, as they are prime
candidates for becoming C reserved words in some future C standard.
(The danger of C++ syntax creeping into C can be seen by the fact
that the latest C standard allows C++ style comments.)  A more
immediate reason to avoid them is that C syntax highlighting
software often shows C++ reserved words as reserved even in
C programs.  (E.g. RHIDE does this.  Or have I just got it set
up wrongly?)

S.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019