Compatible C89 / C90, C99 and C11

I just read: C Wikipedia entry . As far as I know, there are 3 different versions of C that are widely used: C89, C99, and C11. My question is about the compatibility of the source code of different versions. Suppose I am going to write a program (in C11, since this is the latest version) and import a library written in C89. Will these two versions work correctly when compiling all files according to the C11 specification?

Question 1 : Are later versions of C ie C99, C11 supernets of older versions of C? By superset, I mean that the old code will compile without errors of the same value when compiling in accordance with the new C specifications.

I just read that // has different meanings in C89 and C99. Besides this feature, are there C99 and C11 C89 supersets?

If the answer to question 1 is not, then I have 2 more questions.

  • How to transfer old code to new versions? Is there a document that explains this procedure?

  • Is it better to use C89 or C99 or C11?

Thanks for your help in advance.

EDIT : changed ISO C to C89.

+4
source share
4 answers

Are later versions of C ie C99, C11 superset of older versions of C?

, . . C99 C11 C90, . C11 C99.

C90, . , " int" C99. C11 gets.

C11 pdf, " " C11 " " C99.

? , ?

. , . , . , C99 C11, , C99/C11.

C99 C11 .

C89 C99 C11?

C11, . C99 C11 " " .

+7

. C89, restrict , C99 , , , , , -, , .

, , . C89 , , . , malloc(), , , , , - ( , C89 , , ). C99 , "" , , , C89, , C89, C99.

C89, , memcpy , , , , - . C99 , , memcpy T (, , malloc), , , T - - . , , memcpy, , - , , - , , C89 memcpy.

, -fno-strict-aliasing . , C89 , , .

+1

, .

, .c .o, . .

, , , , , , , .

EDIT. undefined.

0

C, , - .

, . , . , , , , C.

, , .

C11 wikipedia article , C99.

0

Source: https://habr.com/ru/post/1666164/


All Articles