mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-26 08:07:33 +02:00
Merge pull request #3036 from JoshuaRLi/master
[c/en] Fixed and improved compiler flag recommendations
This commit is contained in:
@@ -8,6 +8,7 @@ contributors:
|
|||||||
- ["Marco Scannadinari", "https://marcoms.github.io"]
|
- ["Marco Scannadinari", "https://marcoms.github.io"]
|
||||||
- ["Zachary Ferguson", "https://github.io/zfergus2"]
|
- ["Zachary Ferguson", "https://github.io/zfergus2"]
|
||||||
- ["himanshu", "https://github.com/himanshu81494"]
|
- ["himanshu", "https://github.com/himanshu81494"]
|
||||||
|
- ["Joshua Li", "https://github.com/JoshuaRLi"]
|
||||||
---
|
---
|
||||||
|
|
||||||
Ah, C. Still **the** language of modern high-performance computing.
|
Ah, C. Still **the** language of modern high-performance computing.
|
||||||
@@ -19,11 +20,12 @@ memory management and C will take you as far as you need to go.
|
|||||||
> **About compiler flags**
|
> **About compiler flags**
|
||||||
>
|
>
|
||||||
> By default, gcc and clang are pretty quiet about compilation warnings and
|
> By default, gcc and clang are pretty quiet about compilation warnings and
|
||||||
> errors, which can be very useful information. Using some
|
> errors, which can be very useful information. Explicitly using stricter
|
||||||
> stricter compiler flags is recommended. Here is an example you can
|
> compiler flags is recommended. Here are some recommended defaults:
|
||||||
> tweak to your liking:
|
|
||||||
>
|
>
|
||||||
> `-Wall -Wextra -Werror -O0 -ansi -pedantic -std=c11`
|
> `-Wall -Wextra -Werror -O2 -std=c99 -pedantic`
|
||||||
|
>
|
||||||
|
> For information on what these flags do as well as other flags, consult the man page for your C compiler (e.g. `man 1 gcc`) or just search online.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
// Single-line comments start with // - only available in C99 and later.
|
// Single-line comments start with // - only available in C99 and later.
|
||||||
|
Reference in New Issue
Block a user