当前位置:网站首页>Understand which C standards are there & understand the C compilation pipeline

Understand which C standards are there & understand the C compilation pipeline

2022-06-25 21:42:00 mooczhimahu

Which of the following is not C standard . Reference resources :C Language standards

Little knowledge :C The development of language standards

K&R C: 1978 year , Dennis · Ricci (Dennis Ritchie) Blaine · Cornegan (Brian Kernighan) Published a Book , named 《The C Programming Language》. The book was C Language developers call it “K&R”, For many years, it was regarded as C Informal Standard Specification of language . People call this version C The language is “K&R C”.
C89: For unity C Language version ,1983 The National Bureau of standards (American National Standards Institute, abbreviation ANSI) A committee was set up , To make C Language standards .1989 year C Language standards are approved , go by the name of ANSI X3.159-1989 “Programming Language C”. This version of C Language standards are often called ANSI C. And because this version is 89 Completed in , So it's also called C89.
C90: later ANSI Submit this standard to ISO( International standards organization ),1990 By the ISO Adopt as an international standard , be called ISO C. And because this version is 1990 Published in , So it's also called C90. therefore ANSI C、ISO C、C89、C90 this 4 The contents of the two standards are actually the same .
C99: stay ANSI C After the standards are established ,C The norms of language haven't changed much for a long time .1995 year C The programming language working group is interested in C There have been some changes to the language , Become later 1999 Published in ISO/IEC 9899:1999 standard , It's usually called C99. But companies are very interested in C99 The support of people shows different interests . When GCC And some other commercial compilers support C99 Most of the features of , Microsoft and Borland But it doesn't seem to be interested in it .
C11: stay 2011 year 12 month ,ANSI Adopted ISO/IEC 9899:2011 standard , This criterion is usually C11.
C18: 2018 year 6 Released on ISO/IEC 9899:2018 standard , This standard is called C18, It's up to date C Language programming standards , This standard is mainly for C11 Supplemented and amended , No new language features have been introduced .
C2x: The next version of C Language standards , It is expected that 2022 year 12 month 1 Day to complete .
answer :
#include <stdio.h>
int main(int argc, char** argv){
    printf(" This is a C Standard code :%s", "C19");
    return 0;
}

A typical C Program compilation pipeline , Include preprocessing 、 compile 、 assembly 、 Link four links .

 


Suppose the input file is helloworld.c, Use GCC compiler , The compile command is gcc -Wall -save-temps helloworld.c -o helloworld, Which of the following is not C The program processes the files generated by the pipeline ?

answer :

helloworld.txt

analysis :

// hello.c
#include <stdio.h>
int main(){
printf("hello world!\n");
}

$ gcc hello.c # compile
$ ./a.out # perform
hello world!

.c file -----> Pretreatment produces .i file -----> Compile generation .s file -----> Assembly produces .o file -----> Link generation . exe file

There is no mention of .txt file , So choose helloworld.txt

原网站

版权声明
本文为[mooczhimahu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206251844147668.html