Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Incompatibilities Between C & C++ (David R

Incompatibilities Between C & C++ (David R

Ratings: (0)|Views: 117|Likes:
Published by api-3750135

More info:

Published by: api-3750135 on Oct 15, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





Incompatibilities Between
ISO C and ISO C++
By David R. Tribble
Revision 1.0, 2001-08-05
C++ versus C
Changes to C99 versus C++98

oAggregate Initializers
oConditional expression declarations
oDigraph punctuation tokens
oImplicit function declarations
oImplicit variable declarations
oIntermixed declarations and statements

C99 versus C++98

oAlternate punctuation token spellings
oArray parameter qualifiers
oBoolean type
oCharacter literals
oclog identifier
oComma operator results
oComplex floating-point type
oCompound literals
oconst linkage
oDesignated initializers
oDuplicate typedefs
oDynamic sizeof evaluation
oEmpty parameter lists
oEmpty preprocessor function macro arguments
oEnumeration constants
oEnumeration declarations with trailing comma
oEnumeration types
oFlexible array members
oFunction name mangling
oFunction pointers
oHexadecimal floating-point literals
oIEC 60559 arithmetic support
oInline functions

oInteger types headers
oLibrary function prototypes
oLibrary header files
olong long integer type
oNested structure tags
oNon-prototype function declarations
oOld-style casts
oOne definition rule
o_Pragma keyword
oPredefined identifiers
oReserved keywords in C99
oReserved keywords in C++
orestrict keyword
oReturning void
ostatic linkage
oString initializers
oString literals are const
oStructures declared in function prototypes
oType-generic math functions
oTypedefs versus type tags
oVariable-argument function declarators
oVariable-argument preprocessor function macros
oVariable-length arrays
oVoid pointer assignments
oWide character type

Revision History

The C programming language began to be standardized some time around 1985 by the
ANSI X3J9 committee. Several years of effort went by, and in 1989 ANSI approved
the new standard. An ISO committee ratified it a year later in 1990 after adding an
amendment dealing with internationalization issues. The 1989 C standard is known
officially as ANSI/ISO 9899-1989, Programming Languages - C, and this
document refers to the 1989 C standard asC89. The 1990 ISO revision of the
standard is known officially as ISO/IEC 9899-1990, Programming Languages - C,
which is referred to in this document as "C90".

The next version of the C standard was ratified by ISO in 1999. Officially know as
ISO/IEC 9899-1999, Programming Languages - C, it is referred to in this document
as "C99".

The C++ programming language was based on the C programming language as it
existed shortly after the ANSI C standardization effort had begun. Around 1995 an
ISO committee was formed to standardize C++, and the new standard was ratified in
1998, which is officially known as ISO/IEC 14882-1998, Programming Languages

- C++. It is referred to in this document as "C++98" or simply as "C++".

Though the two languages share a common heritage, and though the designers
involved in the standardization processes for each language tried to keep them as
compatible as possible, some incompatibilities unavoidably arose. Once the
programmer is aware of these potential problem spots, they are easy, for the most part,
to avoid when writing C code.

When we say that C isincompatibl e with C++ with respect to a specificlanguage
feature, we mean that a C program that employs that feature either is not valid C++

code and thus will not compile as a C++ program, or that it will compile as a C++
program but will exhibit different behavior than the same program compiled as a C
program. In other words, an incompatible C feature is valid as C code but not as C++
code. All incompatibilities of this kind are addressed in this document. Avoiding these
kinds of incompatibilities allows the programmer to write correct C code that is
intended to interact with, or be compiled as, C++ code.

Another form of incompatible feature is one that is valid when used in a C++
program but is invalid in a C program. We call this an incompatible C++ feature.
Huge portions of the C++ language fall into this category (e.g., classes, templates,
exceptions, references, member functions, anonymous unions, etc.), so very few of
these kinds of incompatibilities are addressed in this document.

Yet another form of incompatible feature occurs when a C++ program uses a feature
that has the same name as a C90 feature but which has a different usage or meaning in
C. This document covers these kinds of incompatibilities.

This document lists only the incompatibilities between C99 and C++98.
(Incompatibilities between C90 and C++ have been documented elsewhere; see
Appendix B of Stroustrup[STR], for example.)
New additions to the C99 standard library are also not addressed in this document
unless they specifically introduce C++ incompatibilities.
C++ versus C
As discussed in theIntroduc tion, no attempt is made in this document to cover
incompatible C++ features, i.e., features of the C++ language or library that are not
supported in C. Huge portions of C++ and its library fall into this category. A partial
list of these features includes:
anonymous unions

Activity (5)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Ana Rodrigues liked this
lamrinraj liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->