-2

Context (You can skip)

I will be doing a presentation on Python, and will be touching upon V3's decision to be intentionally backwards incompatible, and how that has affected Python long term. I will be examining in particular their decision to remove the print keyword, because it was a decision that was not strictly necessary, as far as I know.

However, in order to be fair to the language, I wish to examine where C and C++ have done similar in their past, where they intentionally released a spec that when implimented, would definitely break existing code. I had tried asking around about this, and really only found one particular instance:

Why exactly was the C++ convenience of not requiring a second declaration, removed?

However it seems so esoteric of an example that it can hardly be considered relevant. I get the impression that breakages are actually quite frequent upon every C++ release, it is just not clear to me whether those breakages are bugs/oversights, or rather intentional breakages/deprecations introduced into the spec.


Actual Question:

Regarding C or C++

  • What is an instance where a change was introduced to the spec, that would knowingly break backwards compatibility?
    • To be clear, where old code ceases to be valid or compilable under an updated specification.

Optional Details of Interest:

  • What was the rationalization for this change?
  • Was it absolutely necessary?
  • How did compilers generally handle the change?
    • For example, were compatibility flags introduced? Were compiler warnings added before the change was finally implemented?
  • Were there any significant negative externalities which resulted from this change?
    • For example, years long endeavors to bring a large library up to spec?
  • In hindsight, was the decision made ultimately the best one, or were those involved in the change, express any sort of regret?
5
  • 4
    Questions asking for long lits of things are not well suited for this site. But you can lookup the breaking changes at the official standards, as Caleth pointed out. Unfortunately, asking for 3rd party resources is off-topic for the site. If you ask me for a change similar to the change from Python2 to Python3, I think Stroustrup intentionally chose to make C++ not 100% backwards compatible to C, for the purpose of creating a more powerful language. Commented Jan 20, 2023 at 10:00
  • 1
    Closed now, but the C++ breakages have tended to be in obscure corners and not to affect most codebases, while the print change affected almost every single script, and (more importantly) the unicode change broke almost every single piece of text handling. Also, you can often use older C++ libraries in updated programs, while the same was not true of python and crippled the upgrade. Commented Jan 20, 2023 at 13:57
  • 2
    There was a certain amount of breakage before standardisation, but that was way back in the 90s. It's like asking about pre-ANSI C. Commented Jan 20, 2023 at 14:00
  • The answer will be different for C and C++, please pick one and focus on one. Commented Aug 16 at 20:52
  • 2
    Quite common is new features using new keywords that cannot be used as plain identifiers anymore. For example, at some point “int restrict = 0;” became invalid C. Commented Aug 17 at 4:29

1 Answer 1

4

The (draft) International Standards list all the breaking changes in Annex C (informative) Compatibility [diff]

How did compilers generally handle the change?

Popular C++ compilers have options to target specific versions of the language, e.g. passing a command line argument to the invocation

2
  • I went through some of the list, and some changes are very very obscure (I wouldn’t expect any real code to break) while there are others where you think “why was this code ever allowed” and now it’s not allowed anymore. Commented Aug 24 at 15:29
  • 1
    @gnasher729 third category is "we've added overloads to an overload set, this can make some cases ambiguous or change behaviour" Commented Aug 26 at 8:55

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.