What does the term ANSI C * mean if it is used with GNU89, C89, GNU99, C99?

In the Xcode IDE, I have the option to set the C language dialect to one of

  • ANSI C
  • GNU89
  • C89
  • GNU99
  • C99
  • Default compiler

I understand what they mean except ANSI C. Because, as I know, ANSI C is only one of C89 or C99. But there must be a reason. What does the term ANSI C indicate there?

+3
source share
4 answers

Assuming you essentially use GCC as a compiler, ANSI and C89 are aliases for the same thing. Cm:

http://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#C-Dialect-Options

Apple , , . GCC . , , -ansi GCC (, C99).

0

. @Nicholas Knight XCode C: http://dl.dropbox.com/u/14571816/xcodelang.png

ANSI C , , ANSI C89 ( , C90). XCode GCC C, , , "", -ansi std=, , C .

, -ansi C, -std=c90, -std=c89 -std=iso9899:1990.

-ansi

C -std=c90. ++            -std=c++98.

-std, .

-std=

. C ++.


:

c90

c89

iso9899:1990  ISO C90 ( GNU, ISO C90, ). , -ansi C.


:

iso9899:199409ISO C90, 1.


:

c99

c9x

iso9899:1999

iso9899:199x

ISO C99. , ;                http://gcc.gnu.org/gcc-4.5/c99status.html . c9x                 iso9899: 199x .


:

gnu90

gnu89

GNU- ISO C90 ( C99). C                .


:

gnu99

gnu9x

GNU- ISO C99. ISO C99 GCC,                 . gnu9x .

+6

C "" 70- .

1978 . , (1- ), "K & R C".

1988 . , ANSI (ISO), , , :)

, ANSI 1989 ( C89 ANSI C). ISO (C90), ANSI.

1999 ISO C: , C99.

, , ANSI C , ANSI C ISO C90 . , ANSI C ( ISO C99 , ).

+1

Compilers have profiles of the languages ​​they target, for example, PMg said in its answer. ANSI C was one of the earliest profiles described in K & R.

An interesting question: why do compilers keep a list of obsolete language profiles? Because writing code with an ANSI C profile is a pretty strong guarantee that your code will work with almost any compiler (more importantly, the compiler version).

When software projects claim compatibility with ANSI-C, they tell you that they will compile everywhere when serving or receiving. Lua source code is an example of this.

+1
source

All Articles