Objective-C is said to be a pure superset of C. What is the meaning of this? What does the superset mean in this context? What other examples of such relationships can be cited (except C ++ and Objective-C ++)?

For example in this directory

  • They always say somewhere. Do not spread rumors, bring the source! - D-side
  • 2
    this means only one thing - that any valid C code can be compiled by an Objective-C compiler and it will do exactly what the code compiled by a normal C compiler would do. - KoVadim
  • @twone all that about the question, you have to question, not in the comment. - D-side
  • @KoVadim: Why not as an answer? - VladD
  • Because now the crowd of "watchmen" will come along, will require a link, say that it does not meet the high standards of the site and the like :) - KoVadim

1 answer 1

If some language X (technology) is a pure superset of Y, then this means that the program written in Y will be compiled by the compiler from X and work without any differences. In the case of programming languages, this also means that if we write code in X, then we can mix it (sometimes completely free) with Y in one file.

Contrary to a common misconception, C ++ is not a superset of pure C. There are many examples of code where it will either not compile, or the compiled code will produce different results. The classic example is in si sizeof('a') == sizeof(int) (that is, usually 4), and in C ++, the equality sizeof('a') == sizeof(char) (that is, usually 1).