C,C99,ANSI C和GNU C有什么区别? [英] What is the difference between C, C99, ANSI C and GNU C?

查看:318
本文介绍了C,C99,ANSI C和GNU C有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始通过 codechef 进行编程练习,并已被C和C99之间的区别所困惑。 C是什么意思?是C89吗?检查此提交底部的语言。它包含C和C99。



我在互联网上发现了一些名为GNU C的东西。对于linux / unix系统有不同的C吗? ANSI是否符合C标准?我也在一些地方读过C99严格。这是什么?



有没有其他不同的C标准在使用?有没有什么叫做C 4.3.2或者它是目前使用的gcc版本?

编辑:



有帮助。我会搜索更多,并编辑那些没有答案的东西。



我不是一个编程新手。我知道C语言是什么。我知道ANSI有像C89,C99和C11这样的C标准。不同的C标准不同。

  • 标准化之前的所有内容通常称为K& RC,位于着名书籍之后,C语言的发明者Dennis Ritchie作为作者之一。这是1972年至1989年的C语言。

  • 第一个C标准于1989年在美国国家标准学会ANSI上发布。这个版本被称为C89或ANSI-C。从1989年到1990年,这是C语言。

    。这个版本被称为C90。从技术上讲,它与C89 / ANSI-C相同。从形式上讲,它取代了C89 / ANSI-C,使它们过时了。从1990 - 1999年,C90是C语言。

    请注意,自1989年以来,ANSI与C语言没有任何关系。仍然在谈论ANSI C的程序员通常不知道它的含义。 ISO拥有C语言,通过ISO 9899标准。 1999年,C标准进行了修订,许多事情发生了变化(ISO 9899:1999 )。该版本的标准称为C99。从1999年到2011年,这是C语言。 2011年,C标准再次发生了变化(ISO 9899:2011)。这个版本被称为C11。它是目前C语言的定义。


    $ b

    C99严格可能是指编译器设置强制编译器遵循该信件的标准。 C标准中有一个术语符合实现。本质上它意味着:这个编译器实际上正确地实现了C语言。正确实现C语言的程序在形式上被称为严格符合程序

    GNU C意味着两件事。可以是作为GNU编译器集合(GCC)的一部分的C编译器本身。或者它可能意味着GCC C编译器使用的非标准默认设置。如果你使用 gcc program.c 进行编译,那么你不会根据C标准进行编译,而是使用非标准的GNU设置,这可能被称为GNU C。例如,整个Linux内核都是用非标准的GNU C编写的,而不是标准的C编译器。



    如果你想按照C标准编译你的程序,你应该输入 gcc -std = c99 -pedantic-errors 。如果您的GCC版本支持,请将c99替换为c11。


    I have started programming practice on codechef and have been confused by the difference between C and C99. What does C mean here? Is it C89? Check the languages at the bottom of this submit. It contains both C and C99.

    I found on the internet something called GNU C. Is there a different C for linux/unix systems? Are these compliant to the C standards by ANSI? I have also read in some places "C99 strict". What is this?

    Are there any other different standards of C in use? Is there something called C 4.3.2 or is it the gcc version in current use?

    EDIT:

    This, This, This helped. I'll search more and edit the things that are left unanswered.

    I am not a programming newbie. I know what C language is. I know that there are the different C standards by ANSI like C89, C99 and C11.

    解决方案

    • Everything before standardization is generally called "K&R C", after the famous book, with Dennis Ritchie, the inventor of the C language, as one of the authors. This was "the C language" from 1972-1989.

    • The first C standard was released 1989 nationally in USA, by their national standard institute ANSI. This release is called C89 or ANSI-C. From 1989-1990 this was "the C language".

    • The year after, the American standard was accepted internationally and published by ISO (ISO 9899:1990). This release is called C90. Technically, it is the same standard as C89/ANSI-C. Formally, it replaced C89/ANSI-C, making them obsolete. From 1990-1999, C90 was "the C language".

      Please note that since 1989, ANSI haven't had anything to do with the C language. Programmers still speaking about "ANSI C" generally haven't got a clue about what it means. ISO "owns" the C language, through the standard ISO 9899.

    • In 1999, the C standard was revised, lots of things changed (ISO 9899:1999). This version of the standard is called C99. From 1999-2011, this was "the C language".

    • In 2011, the C standard was changed again (ISO 9899:2011). This version is called C11. It is currently the definition of "the C language".


    "C99 strict" likely refers to a compiler setting forcing a compiler to follow the standard by the letter. There is a term conforming implementation in the C standard. Essentially it means: "this compiler actually implements the C language correctly". Programs that implement the C language correctly are formally called strictly conforming programs.

    "GNU C" can mean two things. Either the C compiler itself that comes as part of the GNU Compiler Collection (GCC). Or it can mean the non-standard default setup that the GCC C compiler uses. If you compile with gcc program.c then you don't compile according to the C standard, but rather a non-standard GNU setup, which may be referred to as "GNU C". For example, the whole Linux kernel is made in non-standard GNU C, and not in standard C.

    If you want to compile your programs according to the C standard, you should type gcc -std=c99 -pedantic-errors. Replace c99 with c11 if your GCC version supports it.

    这篇关于C,C99,ANSI C和GNU C有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆