C WikiBooks - How C small, "what you see is everything you get"?

I cannot understand one of the following suggestions from WikiBooks :

Why is C and not assembly language?

"C is a compiled language that creates fast and efficient executables. It is also a small" language that you see, everything you get ": the C instruction corresponds to no more than a few assembly statements, everything else is provided by library functions."


Link to the site : C Programming / Why study C? - Wikibooks, open books for the open world

Note . I'm a complete novice, and I started learning C. So, I need an accurate explanation of what the above sentence means.

+4
source share
7 answers

Assembly is a language for one processor family; it is directly compiled with machine code that is launched by the processor. If one of the programs is in the assembly, you must rewrite all the code for different processor families. Typically, phones use ARM processors, while desktop computers have 32-bit or 64-bit processors compatible with x86. Every 3 of them potentially need a completely separately written program and may not even be limited to this.

Unlike the C standard, it is a portable language if you write so-called strictly appropriate programs. C11 4p5 :

, . (3) , , undefined , .

5, , :

.

, , C, - , - - .

, C, -, , , , , .

, C , , " ".

+7

compiled language interpreted language.

.

- , , .., .

, C , , , ..

compiled implementation, interpreted implementation for the language, . , compile x86, datapath X86 ..

what you see is all you get , 1 1 CAM, ISO 9899, ​​ , x86, mips ..

+3

C - , Assembly, , C, "" , Assembly. :

" , , " : C

C, , ASM , .., .

, C tinny, , , esentials turing . , C std lib ( tho), , RNG, ..

:

+2

C.

C , , , . , , - - . , .

C ( , ) . - , - C, , , .

"" "" - C , , , . , (, ++), C - - .
+2

K & R C 70 '. C , , :

  • : , a goto
  • : ( !), . ( ) .

, , C. , , .

C . - , , - , . Undefined . , float UB. , UB, , UB ( gcc ).

:

void stopit() {
   int i = 0;
   while(1) {
      i+=1;
   }
   printf("done");
}

, printf . , , :

void stopit() {
   printf("done");
}

int i = 12;
float *f = &i;
*f = 12.5;              // UB use an float variable to access an int
printf("0x%04x\n", i);  // try to dump the representation of 12.5

0x000c, , *f=0. i, printf("0x%04x\n", 12);

, C , " , , ".


, C - . / . , /, . C. : , , . .

+2

C . , C ( ), .

C , , , , C , C.

, , # Java Python. C- C , , " " , , , C. stdio.h . , , . "" .

() - , C - , , , .

+1

" , , "...

C - "" , , , ( -, , ..), ( , ..). C ( ) , , , ..; , (Windows, MacOS, iOS, Linux). , Java, , - .

, ++ Java, C. " ". , , , , "" ( , ) .. - , .

C- , , , , ..

, C, - - (, , , ..) .

C " " , , , , . , , . int () , , ( , , [-32767..32767] [0..65535] ). int ADD/DIV/MUL/SUB. Languages ​​such as Python provide types of "arbitrary precision" that are not limited to what hardware can support - the trade-off is that operations using these types are often slower because you do not use native operation codes.

0
source

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


All Articles