==================== First Steps with C11 [TOC] ==================== Some remarks on compiling C code: - Always compile with the `-Wall` flag to get warnings that often indicate errors. - Compile with `-std=c11` because by default many compiler still use the C89 standard by default. For all examples do the following: - Compile the program, run it and check the exit code. Use the `-o` flag such that the executable is named like the source file without the `.c` suffix. - Look at the output the C preprocessor produces (call `gcc` with the `-E` flag). - Look at the assembler code produced by the compiler: - Use the `-S` flag such that `gcc` stops after translating the C code into assembler code. - Also use the `-fno-asynchronous-unwind-tables` and `-fomit-frame-pointer` flags (otherwise `gcc` produces lots of code we do not want to understand at the moment). - For the ULM we used a different assembly language. However, there are many similarities. Try to understand the meaning of the assembler code produced by `gcc` - Check how the assembler code produced by `gcc` is different when you compile with optimization flags, e.g. - Compile with `-O1` - Compile with `-O2` - Compile with `-O3` Example on Arrays ================= :import: session06/vec_sum.c Example on For loops ==================== :import: session06/for_loop.c Example on While loops ====================== Explain why the following program will not compile. Then fix it and proceed as before: :import: session06/while_loop.c