X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Message-ID: <3C56D822.9BE214E7@NOSPPAMhotmail.com> Date: Tue, 29 Jan 2002 18:13:06 +0100 From: David Leben X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.14-6.1.1 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: C or C++? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 40 NNTP-Posting-Host: nat.be.acunia.com X-Trace: 1012324386 read-nat.news.be.uu.net 7109 194.7.211.211 X-Complaints-To: abuse AT be DOT uu DOT net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com [about //-style comments in the DJGPP FAQ, section 8.4] > You've overlooked the following part of that section: Ok, found it. It was a footnote on another html-page. > While admittedly perverse, this little monstrosity was written with the > sole purpose of demonstrating that C and C++ have quite different semantics > under certain circumstances. Some people think that C is a proper subset > of C++; the above example shows that this is _not_ true. > > In other words, the // comments are just one example of the differences > between the two languages. As // comments are not standard C, but an extension provided by some compilers, I think the example is not that good. But you are right. I looked it up, and the C++ FAQ says: http://www.parashift.com/c++-faq-lite/big-picture.html#[6.10] [6.10] Is C++ backward compatible with ANSI/ISO C? Almost. C++ is as close as possible to compatible with C, but no closer. In practice, the major difference is that C++ requires prototypes, and that f() declares a function that takes no parameters (in C, f() is the same as f(...)). There are some very subtle differences as well, like sizeof('x') is equal to sizeof(char) in C++ but is equal to sizeof(int) in C. Also, C++ puts structure "tags" in the same namespace as other names, whereas C requires an explicit struct (e.g., the typedef struct Fred Fred; technique still works, but is redundant in C++). Regards, David.