On Wed, Nov 12, 2003 at 12:28:32AM +0000, Chris Howells wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> 
> On Tuesday 11 November 2003 23:02, Lowell Gilbert wrote:
> 
> > each other.  [There is a myth that C++ is a superset of C, but this is
> > not really the case.]
> 
> C++ is based on C. Any C code (providing it does not use certain key word that 
> are reserved in C++) can be compiled in a C++ compiler.

Wrong.  C++ is based on C, but it has made some changes so it is not
quite a superset of C.
Try for example the following little program:

#include <stdlib.h>
int main(void)
    {
    char *a;
    a=malloc(10);
    if(a) free(a);
    return 0;
    }

This is valid C, but not valid C++.  (C++ does not perform automatic
conversion between void pointers and other pointers.)
This should suffice to demonstrate that C++ is not really a superset of
C.  The intersection between C and C++ is a usable programming language
though, but it is rarely worth the trouble to restrict oneself to that
subset of the languages.


-- 
<Insert your favourite quote here.>
Erik Trulsson
[EMAIL PROTECTED]
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to