A C source file can be compiled into different target binaries for a PC, phone, set-top box, or other platform. Portability is the property that lets one correct C program work across those environments with little or no modification. section 1.2
Compile the same program with different toolchains
The source file getting-started.c can be compiled with c99, clang, gcc, or icc. Each compiler translates the C program for the platform on which it runs; options such as -Wall request warnings, while -o names the executable. section 1.2
0 > clang -Wall -lm -o getting-started getting-started.c
1 > gcc -std=c99 -Wall -lm -o getting-started getting-started.c
2 > icc -std=c99 -Wall -lm -o getting-started getting-started.c
!@%STYLE%@!
{"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":1}],[{\"line\":1,\"ch\":0},{\"line\":1,\"ch\":1}],[{\"line\":2,\"ch\":0},{\"line\":2,\"ch\":1}]]"}
!@%STYLE%@!
Compare equivalent clang, gcc, and icc commands for compiling the same C source. section 1.2
TAKEAWAY: Correct C programs are intended to be portable, but compiling and testing on one platform cannot guarantee portability. Some platforms do not conform to current standards, and extensions may not be widely portable. Treat compiler warnings as evidence that the program may need correction. section 1.2 section 1.3




