C++ and ANSI C

Henry Spencer henry at utzoo.uucp
Thu May 4 10:19:11 AEST 1989


In article <44100029 at hcx2> daver at hcx2.SSD.HARRIS.COM writes:
>From "Computerworld" (4/24/89, p. 31):
> "... A key selling point of C++ is its relationship with the established C
> language.  It includes ANSI-standard C as a subset, as does Objective C, ..."
>
>Perhaps statements like the above cause the confusion...

Quite likely, since they're not true.  There are a couple of fundamental
incompatibilities between C++ and C (ANSI or not), plus a number of minor
ways in which ANSI C differs from C++ in areas where they overlap.  Most
of the latter will go away when Bjarne's crew gets the new official C++
reference manual out the door, but at the moment ANSI C is *not* a subset
of C++, even if you ignore the big incompatibilities.  Computerworld, as
usual, basically doesn't know what it's talking about.

To break the suspense, the two big incompatibilities are:

1. "extern foo();" means (so to speak) "extern foo(...);" in ANSI C and
	"extern foo(void);" in C++

2. declaring a struct or union tag in C++ essentially does an implicit
	typedef on that identifier as well
-- 
Mars in 1980s:  USSR, 2 tries, |     Henry Spencer at U of Toronto Zoology
2 failures; USA, 0 tries.      | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list