add guidelines about compiler warning, change c11 to gnu17

This commit is contained in:
Landon Curt Noll committed 2024-06-24 18:42:26 -07:00
1 parent 4690ba97c1
commit 1110280c24
2 files changed
+18 -50

No files matched your search

+9 -23
View File
@@ -561,18 +561,10 @@ as a program that is more well rounded in confusion.</p>
<p>When declaring local or global variables, you should declare the type:</p> <p>When declaring local or global variables, you should declare the type:</p>
<pre><code> int this_is_fine; <pre><code> int this_is_fine;
this_is_not; /* &lt;-- Try to avoid implicit type declarations */</code></pre> this_is_not; /* &lt;-- Try to avoid implicit type declarations */</code></pre>
<p>We suggest that you compile your entry with a commonly available <p><strong><code>|</code></strong> We suggest that you compile your entry with a commonly available
c11 (formerly C1X) C compiler (ISO/IEC 9899:2011).</p> gnu17 (ISO C 2017 with GNU extensions) C compiler.</p>
<p>Do not assume that optional c11 features are supported. If you <p>We really <strong>LIKE</strong> code that has a minimum of warnings, especially under the
must use an optional c11 feature, use feature test macros so more strict <code>-Wall -Wextra -pedantic</code> mode:</p>
that implementations without such optional c11 features will see
an entry that is both functional and interesting.</p>
<p>We <strong>LIKE</strong> entries that have workarounds that allow someone with
nean older c99 (ISO/IEC 9899:1999) compiler to be able to compile
and enjoy your entry.</p>
<p>We really <strong>LIKE</strong> “lint free” code. However lint is a toll of the past.
So try to ensure that your entry compiles warning free. If possible,
to compile compile your code using:</p>
<pre><code> -Wall -Wextra -pedantic</code></pre> <pre><code> -Wall -Wextra -pedantic</code></pre>
<p>For compilers, such as clang, that have the <code>-Weverything</code> option, try <p>For compilers, such as clang, that have the <code>-Weverything</code> option, try
to make your code compile warning free using:</p> to make your code compile warning free using:</p>
@@ -587,17 +579,11 @@ your <code>Makefile</code>.</p>
warnings will be considered better, for certain values of better.</p> warnings will be considered better, for certain values of better.</p>
<p><strong><code>|</code></strong> Unless you clearly state otherwise in your <code>remarks.md</code> file <strong>AS WELL AS</strong> in <p><strong><code>|</code></strong> Unless you clearly state otherwise in your <code>remarks.md</code> file <strong>AS WELL AS</strong> in
your “how to build” / Makefile we will compile using:</p> your “how to build” / Makefile we will compile using:</p>
<pre><code> -O3 -std=c11</code></pre> <pre><code> -O3 -std=gnu17</code></pre>
<p>Anyone care to submit an entry that makes gratuitous use of all <p><strong><code>|</code></strong> There is no real penalty for compiler warnings. Sometimes compiler warnings cannot be helped: especially in the case of obfuscated C. :-) So if you cannot easily get rid of a compiler warning, try not fret too much. Just add the needed “<code>-Wno-somethings</code>” to your Makefile. We suggest you add then to the <code>CSILENCE=</code> line, if you use some variant of the <a href="https://github.com/ioccc-src/mkiocccentry/blob/master/Makefile.example">example Makefile</a> from the <a href="https://github.com/ioccc-src/mkiocccentry">IOCCC mkiocccentry repo</a>.</p>
of the c11 reserved words in their intended C language contexts? <p><strong><code>|</code></strong> If you do add “<code>-Wno-somethings</code>” to your Makefile, consider also adding <code>-Wno-unknown-warning-option</code> just in case the warning you use is not available in the compilers we use test your submission.</p>
NOTE: As with the use of the word Belgium, the use of certain gratuitous <p><strong><code>|</code></strong> <strong>DO NOT</strong> assume that we will use <strong>gcc</strong> to compile your program.
c11 reserved words may be completely banned in all parts of the Galaxy, We will first try to compile your program using <strong>clang</strong>.</p>
except in one small part (ISO/IEC 9899:2011) where they might not truly
understand the implications of such words.</p>
<pre><code> http://hitchhikers.wikia.com/wiki/Belgium
http://www.bezem.de/pdf/ReservedWordsInC.pdf</code></pre>
<p><strong>DO NOT</strong> assume that we will use gcc to compile your program.
We will first try to compile your program using Clang.</p>
<p>It is much better to not use any obscure compiler flags if <p>It is much better to not use any obscure compiler flags if
you can help it. We want to discourage the use of obscure compiler you can help it. We want to discourage the use of obscure compiler
flags that would make the program less portable.</p> flags that would make the program less portable.</p>
+9 -27
View File
@@ -255,21 +255,11 @@ When declaring local or global variables, you should declare the type:
this_is_not; /* <-- Try to avoid implicit type declarations */ this_is_not; /* <-- Try to avoid implicit type declarations */
``` ```
We suggest that you compile your entry with a commonly available **`|`** We suggest that you compile your entry with a commonly available
c11 (formerly C1X) C compiler (ISO/IEC 9899:2011). gnu17 (ISO C 2017 with GNU extensions) C compiler.
Do not assume that optional c11 features are supported. If you We really **LIKE** code that has a minimum of warnings, especially under the
must use an optional c11 feature, use feature test macros so more strict ` -Wall -Wextra -pedantic` mode:
that implementations without such optional c11 features will see
an entry that is both functional and interesting.
We **LIKE** entries that have workarounds that allow someone with
nean older c99 (ISO/IEC 9899:1999) compiler to be able to compile
and enjoy your entry.
We really **LIKE** "lint free" code. However lint is a toll of the past.
So try to ensure that your entry compiles warning free. If possible,
to compile compile your code using:
``` ```
-Wall -Wextra -pedantic -Wall -Wextra -pedantic
@@ -302,23 +292,15 @@ warnings will be considered better, for certain values of better.
your "how to build" / Makefile we will compile using: your "how to build" / Makefile we will compile using:
``` ```
-O3 -std=c11 -O3 -std=gnu17
``` ```
Anyone care to submit an entry that makes gratuitous use of all **`|`** There is no real penalty for compiler warnings. Sometimes compiler warnings cannot be helped: especially in the case of obfuscated C. :-) So if you cannot easily get rid of a compiler warning, try not fret too much. Just add the needed "`-Wno-somethings`" to your Makefile. We suggest you add then to the `CSILENCE=` line, if you use some variant of the [example Makefile](https://github.com/ioccc-src/mkiocccentry/blob/master/Makefile.example) from the [IOCCC mkiocccentry repo](https://github.com/ioccc-src/mkiocccentry).
of the c11 reserved words in their intended C language contexts?
NOTE: As with the use of the word Belgium, the use of certain gratuitous
c11 reserved words may be completely banned in all parts of the Galaxy,
except in one small part (ISO/IEC 9899:2011) where they might not truly
understand the implications of such words.
``` **`|`** If you do add "`-Wno-somethings`" to your Makefile, consider also adding `-Wno-unknown-warning-option` just in case the warning you use is not available in the compilers we use test your submission.
http://hitchhikers.wikia.com/wiki/Belgium
http://www.bezem.de/pdf/ReservedWordsInC.pdf
```
**DO NOT** assume that we will use gcc to compile your program. **`|`** **DO NOT** assume that we will use **gcc** to compile your program.
We will first try to compile your program using Clang. We will first try to compile your program using **clang**.
It is much better to not use any obscure compiler flags if It is much better to not use any obscure compiler flags if
you can help it. We want to discourage the use of obscure compiler you can help it. We want to discourage the use of obscure compiler