delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/30/07:32:18

Date: Thu, 30 Oct 1997 14:29:25 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Roman Suzi <nuser AT rsuzi DOT pgu DOT karelia DOT ru>
cc: djgpp AT delorie DOT com
Subject: Re: [Q]: unsigned char --- C and C++ difference!!!
In-Reply-To: <AB4PvLqa6O@rsuzi.pgu.karelia.ru>
Message-ID: <Pine.SUN.3.91.971030142301.2104C-100000@is>
MIME-Version: 1.0

On Wed, 29 Oct 1997, Roman Suzi wrote:

> When I renamed the program to probe.c -- the
> sizeof('\xFD') changed to 4 !!!
> 
> I have never heard of such *tremendous* differences
> between C and C++.
> 
> I just wonder, how much other 'subtle' differences
> there exist between C and C++ ?

This is a common misconception.  Many people erroneously believe that C++ 
is a proper superset of C, so anything that will compile in C, will also 
compile in C++ and produce identical results.

This is simply NOT TRUE.  C++ is a DIFFERENT LANGUAGE; the differences
might be subtle, but they are SIGNIFICANT.

So, if you want to write a C program, call it foo.c and compile it as C 
program.  Do NOT call it foo.cc or foo.cpp and do NOT compile it as C++.  
It might work, but it will get you in trouble one day.

Another (deliberately perverse) example of difference between these 
languages can be found in section 8.3 of the DJGPP FAQ list.

- Raw text -


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