[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

Friday, December 16, 2022

C xor C++ Programming

Aaron Ballman (PDF via John Regehr, Steve Canon):

It is not uncommon to hear about C/C++ programming as a shorthand for “C and C++” programming. This implies that C and C++ are similar, but distinct, programming languages with the obvious interpretation being that C++ is a proper superset of C. However, this does not accurately describe the situation. The C++ programming language is inspired by the C programming language and supports much of the syntax and semantics of C, but is not a superset that is built on top of C. Despite sharing a historical relationship to one another, the languages have evolved independently and are specified in separate language standards. Due to this separation of the two specifications, incompatibilities have crept into the shared space of code that can be compiled by either a C compiler or a C++ compiler.

This document enumerates instances where the same source code has different meaning when compiled with C and C++ implementations. Such source code is often a pain point for users and implementers because it represents a “sharp edge” in both languages, especially if the code appears in a header file that may be compiled in separate C and C++ translation units.

2 Comments RSS · Twitter


You shouldn't say "C/C++". C/C++ programmers hate it when you do that.


Not sure I find this speciation useful. Change for the sake of change, versus change because the benefits warrant it.

Leave a Comment