checkpoint guideline fixes
Attempt to fix HTML5 errors. Remove Makefile section from Guidelines as this is in the FAQ. Added links to Makefile FAQ in Guidelines. Ran `make quick_www` to perform the above TODO: Complete the correction for issue #244 ("Restore guidelines"). TODO: Continue to revise and improve the IOCCC guidelines as needed. TODO: Fix typos/nits in the `next/guidelines.md` if needed. TODO: Fix typos/nits in the `next/rules.md` if needed.
This commit is contained in:
1 parent
c5bd5b33a4
commit
4256b02327
3 files changed
+11
-627
No files matched your search
+4
-269
@@ -626,6 +626,8 @@ in the building and compiling of your submission.</p>
|
||||
<p>Your Makefile <strong>MUST</strong> be compatible with GNU <code>make</code> and we suggest you use
|
||||
<a href="Makefile.example">Makefile.example</a> as a template, renamed as Makefile of
|
||||
course.</p>
|
||||
<p>See the
|
||||
FAQ on “<a href="../faq.html#makefile_details">What are the detailed recommendations for a submission Makefile?</a>”.</p>
|
||||
<p>Jump to: <a href="#">top</a></p>
|
||||
<div id="guideline17">
|
||||
<div id="guideline-17---packaging">
|
||||
@@ -826,273 +828,8 @@ FAQ on “<a href="../faq.html#about_mkiocccentry">What is mkiocccentry in simpl
|
||||
<p>See
|
||||
FAQ on “<a href="../faq.html#mkiocccentry">What is the mkiocccentry tool, how do I obtain it and how do I use it</a>”.</p>
|
||||
<p>Jump to: <a href="#">top</a></p>
|
||||
<div id="make">
|
||||
<div id="makefile">
|
||||
<h1 id="makefiles">Makefiles</h1>
|
||||
</div>
|
||||
</div>
|
||||
<p class="leftbar">
|
||||
We <strong>recommend</strong> AND <strong>encourage</strong> you to use the example Makefile,
|
||||
as the starting point for your submission’s required <code>Makefile</code>:
|
||||
</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/next/Makefile.example">view example Makefile</a></li>
|
||||
<li><a href="Makefile.example" download="Makefile">download example Makefile</a></li>
|
||||
</ul>
|
||||
<p class="leftbar">
|
||||
Feel free to modify the <code>Makefile</code> to suit your obfuscation
|
||||
needs.
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
<strong>Please</strong> add a space between the <code>=</code> and the value of variables, in the
|
||||
<code>Makefile</code>, making sure that the <code>=</code> comes immediately after the name. See the
|
||||
example <code>Makefile</code> for examples.
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
The rest of this section and its subsections will assume that you are using some
|
||||
variant of the example <code>Makefile</code>, again renamed as <code>Makefile</code>.
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
We suggest that you compile your submission with a commonly available
|
||||
<code>-std=gnu17</code> (ISO C 2017 with GNU extensions) C compiler, via <code>clang(1)</code>
|
||||
and/or <code>gcc(1)</code>.
|
||||
</p>
|
||||
<div id="cflags">
|
||||
<div id="flags">
|
||||
<h2 id="default-compiler-flags">Default compiler flags</h2>
|
||||
</div>
|
||||
</div>
|
||||
<p class="leftbar">
|
||||
Unless you <strong>clearly state</strong> otherwise in your <code>remarks.md</code> file, <strong>AND</strong> put in
|
||||
your submission’s <code>Makefile</code>, we <strong>will</strong> compile using <code>-std=gnu17 -O3</code>!
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
It <strong>is OK</strong> if you need to require your submission to <strong>NOT be</strong> compiled
|
||||
using the default <code>-std=gnu17 -O3</code> settings. Simply <strong>explain why</strong>
|
||||
your submission should NOT be compiled using <code>-std=gnu17 -O3</code> in
|
||||
your <code>remarks.md</code> file, <strong>AND</strong> adjust your <code>Makefile</code> accordingly.
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
One reason that you might have to change the flags, is that the optimiser is
|
||||
known to break some programs, but there are certainly other possible valid
|
||||
reasons. Again, just update the <code>Makefile</code> and explain it in your <code>remarks.md</code>.
|
||||
See the <a href="#optimiser">optimiser section</a> for details for changing optimiser
|
||||
flags.
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
For more fun when it comes to optimisers breaking code, see
|
||||
<a href="../1986/marshall/compilers.html">1986/marshall/compilers.html</a>.
|
||||
</p>
|
||||
<div id="compilers">
|
||||
<h2 id="default-compiler">Default compiler</h2>
|
||||
</div>
|
||||
<p class="leftbar">
|
||||
<strong>IMPORTANT NOTE</strong>: The use of <code>-std=gnu17</code> does <strong>NOT</strong> imply the use of the <code>gcc</code>
|
||||
compiler! We often start by compiling using the <strong>clang</strong> C compiler instead.
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
<strong>PLEASE NOTE</strong>: in macOS, the compiler <code>gcc</code> found at <code>/usr/bin/gcc</code> is
|
||||
in truth the <code>clang</code> compiler, as <code>/usr/bin/gcc --version</code> will show!
|
||||
</p>
|
||||
<div id="cstd">
|
||||
<div id="standard">
|
||||
<h2 id="c-standard">C standard</h2>
|
||||
</div>
|
||||
</div>
|
||||
<p class="leftbar">
|
||||
You may change the standard under which your submission is compiled
|
||||
by modifying the <code>CSTD</code> Makefile variable. For example, to use <code>c99</code> instead:
|
||||
</p>
|
||||
<pre><code> CSTD= -std=c99</code></pre>
|
||||
<div id="opt">
|
||||
<div id="optimization">
|
||||
<div id="optimisation">
|
||||
<div id="optimizer">
|
||||
<div id="optimiser">
|
||||
<h2 id="default-optimisation-level">Default optimisation level</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="leftbar">
|
||||
You may change the level of optimization and compiler debug level
|
||||
that your submission is compiled with, by modifying the <code>OPT</code> Makefile variable.
|
||||
For example, to compile without optimization, and to include debug symbols:
|
||||
</p>
|
||||
<pre><code> OPT= -O0 -g3</code></pre>
|
||||
<div id="warnings">
|
||||
<div id="cwarn">
|
||||
<h2 id="compiler-warnings">Compiler warnings</h2>
|
||||
</div>
|
||||
</div>
|
||||
<p class="leftbar">
|
||||
The default warning flags are set via the <code>CWARN</code> variable, as shown in the
|
||||
example <code>Makefile</code>:
|
||||
</p>
|
||||
<pre><code> # Common C compiler warning flags
|
||||
#
|
||||
CWARN= -Wall -Wextra ${CSILENCE} ${CUNKNOWN}</code></pre>
|
||||
<p class="leftbar">
|
||||
For details on <code>CSILENCE</code> and <code>CUNKNOWN</code>, see the <a href="#disabling-warnings">section on disabling
|
||||
warnings</a>.
|
||||
</p>
|
||||
<div id="weverything">
|
||||
<h3 id="the--weverything-option">The <code>-Weverything</code> option</h3>
|
||||
</div>
|
||||
<p class="leftbar">
|
||||
For compilers, such as <code>clang</code>, that have the <code>-Weverything</code> option,
|
||||
while you may wish to try it, you should read our
|
||||
FAQ on “<a href="../faq.html#weverything">clang -Weverything</a>”.
|
||||
We do <strong>NOT</strong> recommend that you put
|
||||
the use of <code>-Weverything</code> into your submission’s <code>Makefile</code> for the reasons
|
||||
cited there. This goes even if your version does not trigger a warning as some
|
||||
other version might!
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
On the other hand, if <code>${CC}</code> has “<code>clang</code>” in the name, the example <code>Makefile</code> will
|
||||
automatically enable <code>-Weverything</code>, so you might have to use <code>-Wno-foo</code>
|
||||
options anyway, as detailed below. See the
|
||||
FAQ on “<a href="../faq.html#weverything">-Weverything</a>”
|
||||
for more details.
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
If “<code>clang</code>” is NOT in <code>${CC}</code>, the <code>CWARN</code> variable will not be further
|
||||
modified.
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
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 to fret too much.
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
We <strong>LIKE</strong> code that has a minimum of warnings, especially under the
|
||||
more strict <code>-Wall -Wextra -pedantic</code> mode:
|
||||
</p>
|
||||
<pre><code> CWARN= -Wall -Wextra -pedantic</code></pre>
|
||||
<p class="leftbar">
|
||||
The two previous guidelines might be thought by some as being somewhat
|
||||
contradictory. Isn’t life, and isn’t trying to satisfy “contradictory customer
|
||||
requirements” all too often like that? :-) Try to minimize warnings if you
|
||||
can.
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
If you manage to produce very few warnings, or perhaps no warnings at
|
||||
all under the <code>-Wall -Wextra -pedantic</code> mode, then by all means brag about it in
|
||||
your <code>remarks.md</code> file <strong>AND BE SURE TO TELL US</strong> the OS, OS version, compiler
|
||||
and compiler version in which you observed this occurring (in case our OS and
|
||||
compiler produces a different result: so your submission won’t be penalized for
|
||||
not meeting your claims).
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
On the other hand, some warnings cannot be disabled and are enabled by compilers
|
||||
without any warning option specified. These are sometimes inevitable in
|
||||
obfuscated code and even in some non-obfuscated code, and you should not worry
|
||||
about this, though it might be worth pointing out.
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
For instance, some compilers like to warn about use of pointers as arrays, which seems to
|
||||
be dubious, as it obviously can’t (always) be avoided, being a big part of C, so
|
||||
you should not worry about this either; this is the warning
|
||||
<code>-Wunsafe-buffer-usage</code> and the way to disable it is <code>-Wno-unsafe-buffer-usage</code>.
|
||||
See also the
|
||||
FAQ on “<a href="../faq.html#forced_warnings">forced warnings</a>”
|
||||
and the
|
||||
FAQ on “<a href="../faq.html#weverything">-Weverything</a>”.
|
||||
</p>
|
||||
<h2 id="disabling-warnings">Disabling warnings</h2>
|
||||
<p class="leftbar">
|
||||
If you do have to disable warnings due to <code>-Weverything</code> automatically being
|
||||
included, you might wish to state this fact in your <code>remarks.md</code> file.
|
||||
And even without <code>-Weverything</code> there can be warnings, as noted above.
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
If your submission issues lots of warnings but is otherwise
|
||||
marvelously obfuscated in multiple levels, don’t worry about it. Nevertheless,
|
||||
be sure that the warnings do not constitute a potential “<strong>show stopper</strong>”
|
||||
compiler problem. Be sure that compilers such as both <code>gcc</code> and <code>clang</code> won’t
|
||||
produce a compiler <strong>error</strong> and refuse to compile your code: unless for some
|
||||
reason that is what you intend to happen in which case document that too in your
|
||||
<code>remarks.md</code> file. :-)
|
||||
</p>
|
||||
<p>All other things being equal, a program that must turn off fewer
|
||||
warnings will be considered better, for certain values of better.</p>
|
||||
<p class="leftbar">
|
||||
To turn off a compiler warning, in your submission’s <code>Makefile</code>,
|
||||
try something such as:
|
||||
</p>
|
||||
<pre><code> CSILENCE= -Wno-some-thing -Wno-another-thing</code></pre>
|
||||
<p class="leftbar">
|
||||
For instance:
|
||||
</p>
|
||||
<pre><code> CSILENCE= -Wno-parentheses -Wno-binding-in-condition -Wno-misleading-indentation</code></pre>
|
||||
<p class="leftbar">
|
||||
If you do add “<code>-Wno-foo</code>” to your Makefile, consider changing:
|
||||
</p>
|
||||
<pre><code> CUNKNOWN=</code></pre>
|
||||
<p class="leftbar">
|
||||
to:
|
||||
</p>
|
||||
<pre><code> CUNKNOWN= -Wno-unknown-warning-option</code></pre>
|
||||
<p class="leftbar">
|
||||
Some compilers have reported this as an error, however, and if you have
|
||||
such a compiler you might want to not add it, or at least note in your
|
||||
<code>remarks.md</code> file, which OS, OS version, compiler and compiler version
|
||||
that has such a problem.
|
||||
</p>
|
||||
<div id="macros">
|
||||
<h2 id="defining-macros-in-the-makefile">Defining macros in the Makefile</h2>
|
||||
</div>
|
||||
<p class="leftbar">
|
||||
If you need to define something on the compile line, use
|
||||
the <code>CDEFINE</code> Makefile variable. For example:
|
||||
</p>
|
||||
<pre><code> CDEFINE= -Dfoo -Dbar=baz</code></pre>
|
||||
<p class="leftbar">
|
||||
<strong>NOTE</strong>: just because we offer a default way to use the <code>-D</code> option, we still
|
||||
do not like excess use of <code>-D</code> to get past size limits, especially since you
|
||||
could use <code>#define</code> in your code instead.
|
||||
</p>
|
||||
<div id="include">
|
||||
<h2 id="include-files-in-the-makefile">Include files in the Makefile</h2>
|
||||
</div>
|
||||
<p class="leftbar">
|
||||
If you need to include a file (as in <code>#include</code>) on the command line, use the
|
||||
<code>CINCLUDE</code> Makefile variable. For example:
|
||||
</p>
|
||||
<pre><code> CINCLUDE= -include stdio.h</code></pre>
|
||||
<div id="magic">
|
||||
<h2 id="magic-in-the-makefile">Magic in the Makefile</h2>
|
||||
</div>
|
||||
<p class="leftbar">
|
||||
If you need to add other “<strong>magic</strong>” flags to your compile line,
|
||||
use the <code>COTHER</code> Makefile variable. For example:
|
||||
</p>
|
||||
<pre><code> COTHER= -fno-math-errno</code></pre>
|
||||
<p class="leftbar">
|
||||
<strong>NOTE</strong>: <strong>We only recommend using “<em>magic</em>” flags if <em>BOTH</em> <code>gcc</code>
|
||||
<em>and</em> <code>clang</code></strong> support it.
|
||||
</p>
|
||||
<p class="leftbar">
|
||||
Again, please note that in macOS, <code>/usr/bin/gcc</code> is actually <code>clang</code>!
|
||||
</p>
|
||||
<div id="clobber">
|
||||
<h2 id="the-clobber-rule">The clobber rule</h2>
|
||||
</div>
|
||||
<p class="leftbar">
|
||||
When <code>make clobber</code> is invoked, we request that submissions be restored
|
||||
to their original submission state. For example, any temporary files
|
||||
(<strong>including</strong> the compiled program(s)) created during the build process, or
|
||||
during execution should be removed by the <code>clobber</code> rule. In other words, the
|
||||
only things that should be in the directory after running <code>make clobber</code> is what
|
||||
is in your submission tarball itself.
|
||||
</p>
|
||||
<div id="general">
|
||||
<h1 id="general-guidelines">General Guidelines</h1>
|
||||
</div>
|
||||
<div id="general">
|
||||
|
||||
</div>
|
||||
<h1 id="general-overall-guidelines">General Overall Guidelines</h1>
|
||||
<p>These <a href="guidelines.html">guideline</a> are <strong>hints</strong> and <strong>suggestions</strong>, <strong>NOT</strong> <a href="rules.html">IOCCC rules</a>.</p>
|
||||
@@ -1616,14 +1353,12 @@ You do?!? (Except on Tuesday?)</p>
|
||||
unless you count this one, in which case there are 3. :-)</p>
|
||||
<p><strong>NOTE</strong>: The previous <em>guideline</em> in this spot has been replaced by this <em>guideline</em>:</p>
|
||||
<p class="leftbar">
|
||||
<blockquote>
|
||||
<p>You very well might not be completely prohibited from failing to not partly
|
||||
You very well might not be completely prohibited from failing to not partly
|
||||
misunderstand this particular <em>guideline</em>, but of course, we could not possibly
|
||||
comment! :-) Nevertheless, you are neither prohibited, nor are you fully or partly
|
||||
required to determine that this or the previous sentence is either false and/or
|
||||
perhaps misleading. Therefore, it might be wise for you to not fail to consider
|
||||
to not do so, accordingly. Thank you very much (allegedly).</p>
|
||||
</blockquote>
|
||||
to not do so, accordingly. Thank you very much (allegedly).
|
||||
</p>
|
||||
<p>Any complaints about the above <em>guideline</em> could be addressed to the
|
||||
Speaker of the House of Commons, or to the speaker of your national
|
||||
|
||||
+4
-355
@@ -231,6 +231,9 @@ Your Makefile **MUST** be compatible with GNU `make` and we suggest you use
|
||||
[Makefile.example](Makefile.example) as a template, renamed as Makefile of
|
||||
course.
|
||||
|
||||
See the
|
||||
FAQ on "[What are the detailed recommendations for a submission Makefile?](../faq.html#makefile_details)".
|
||||
|
||||
|
||||
Jump to: [top](#)
|
||||
|
||||
@@ -506,364 +509,10 @@ FAQ on "[What is the mkiocccentry tool, how do I obtain it and how do I use it](
|
||||
|
||||
Jump to: [top](#)
|
||||
|
||||
<div id="make">
|
||||
<div id="makefile">
|
||||
# Makefiles
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="leftbar">
|
||||
We **recommend** AND **encourage** you to use the example Makefile,
|
||||
as the starting point for your submission's required `Makefile`:
|
||||
</p>
|
||||
|
||||
- [view example Makefile](%%REPO_URL%%/next/Makefile.example)
|
||||
- <a href="Makefile.example" download="Makefile">download example Makefile</a>
|
||||
|
||||
<p class="leftbar">
|
||||
Feel free to modify the `Makefile` to suit your obfuscation
|
||||
needs.
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
**Please** add a space between the `=` and the value of variables, in the
|
||||
`Makefile`, making sure that the `=` comes immediately after the name. See the
|
||||
example `Makefile` for examples.
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
The rest of this section and its subsections will assume that you are using some
|
||||
variant of the example `Makefile`, again renamed as `Makefile`.
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
We suggest that you compile your submission with a commonly available
|
||||
`-std=gnu17` (ISO C 2017 with GNU extensions) C compiler, via `clang(1)`
|
||||
and/or `gcc(1)`.
|
||||
</p>
|
||||
|
||||
<div id="cflags">
|
||||
<div id="flags">
|
||||
## Default compiler flags
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="leftbar">
|
||||
Unless you **clearly state** otherwise in your `remarks.md` file, **AND** put in
|
||||
your submission's `Makefile`, we **will** compile using `-std=gnu17 -O3`!
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
It **is OK** if you need to require your submission to **NOT be** compiled
|
||||
using the default `-std=gnu17 -O3` settings. Simply **explain why**
|
||||
your submission should NOT be compiled using `-std=gnu17 -O3` in
|
||||
your `remarks.md` file, **AND** adjust your `Makefile` accordingly.
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
One reason that you might have to change the flags, is that the optimiser is
|
||||
known to break some programs, but there are certainly other possible valid
|
||||
reasons. Again, just update the `Makefile` and explain it in your `remarks.md`.
|
||||
See the [optimiser section](#optimiser) for details for changing optimiser
|
||||
flags.
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
For more fun when it comes to optimisers breaking code, see
|
||||
[1986/marshall/compilers.html](../1986/marshall/compilers.html).
|
||||
</p>
|
||||
|
||||
|
||||
<div id="compilers">
|
||||
## Default compiler
|
||||
</div>
|
||||
|
||||
<p class="leftbar">
|
||||
**IMPORTANT NOTE**: The use of `-std=gnu17` does **NOT** imply the use of the `gcc`
|
||||
compiler! We often start by compiling using the **clang** C compiler instead.
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
**PLEASE NOTE**: in macOS, the compiler `gcc` found at `/usr/bin/gcc` is
|
||||
in truth the `clang` compiler, as `/usr/bin/gcc --version` will show!
|
||||
</p>
|
||||
|
||||
|
||||
<div id="cstd">
|
||||
<div id="standard">
|
||||
## C standard
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="leftbar">
|
||||
You may change the standard under which your submission is compiled
|
||||
by modifying the `CSTD` Makefile variable. For example, to use `c99` instead:
|
||||
</p>
|
||||
|
||||
|
||||
``` <!---make-->
|
||||
CSTD= -std=c99
|
||||
```
|
||||
|
||||
<div id="opt">
|
||||
<div id="optimization">
|
||||
<div id="optimisation">
|
||||
<div id="optimizer">
|
||||
<div id="optimiser">
|
||||
## Default optimisation level
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="leftbar">
|
||||
You may change the level of optimization and compiler debug level
|
||||
that your submission is compiled with, by modifying the `OPT` Makefile variable.
|
||||
For example, to compile without optimization, and to include debug symbols:
|
||||
</p>
|
||||
|
||||
``` <!---make-->
|
||||
OPT= -O0 -g3
|
||||
```
|
||||
|
||||
<div id="warnings">
|
||||
<div id="cwarn">
|
||||
## Compiler warnings
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="leftbar">
|
||||
The default warning flags are set via the `CWARN` variable, as shown in the
|
||||
example `Makefile`:
|
||||
</p>
|
||||
|
||||
``` <!---sh-->
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
CWARN= -Wall -Wextra ${CSILENCE} ${CUNKNOWN}
|
||||
```
|
||||
|
||||
<p class="leftbar">
|
||||
For details on `CSILENCE` and `CUNKNOWN`, see the [section on disabling
|
||||
warnings](#disabling-warnings).
|
||||
</p>
|
||||
|
||||
<div id="weverything">
|
||||
### The `-Weverything` option
|
||||
</div>
|
||||
|
||||
<p class="leftbar">
|
||||
For compilers, such as `clang`, that have the `-Weverything` option,
|
||||
while you may wish to try it, you should read our
|
||||
FAQ on "[clang -Weverything](../faq.html#weverything)".
|
||||
We do **NOT** recommend that you put
|
||||
the use of `-Weverything` into your submission's `Makefile` for the reasons
|
||||
cited there. This goes even if your version does not trigger a warning as some
|
||||
other version might!
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
On the other hand, if `${CC}` has "`clang`" in the name, the example `Makefile` will
|
||||
automatically enable `-Weverything`, so you might have to use `-Wno-foo`
|
||||
options anyway, as detailed below. See the
|
||||
FAQ on "[-Weverything](../faq.html#weverything)"
|
||||
for more details.
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
If "`clang`" is NOT in `${CC}`, the `CWARN` variable will not be further
|
||||
modified.
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
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 to fret too much.
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
We **LIKE** code that has a minimum of warnings, especially under the
|
||||
more strict ` -Wall -Wextra -pedantic` mode:
|
||||
</p>
|
||||
|
||||
``` <!---make-->
|
||||
CWARN= -Wall -Wextra -pedantic
|
||||
```
|
||||
|
||||
<p class="leftbar">
|
||||
The two previous guidelines might be thought by some as being somewhat
|
||||
contradictory. Isn't life, and isn't trying to satisfy "contradictory customer
|
||||
requirements" all too often like that? :-) Try to minimize warnings if you
|
||||
can.
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
If you manage to produce very few warnings, or perhaps no warnings at
|
||||
all under the `-Wall -Wextra -pedantic` mode, then by all means brag about it in
|
||||
your `remarks.md` file **AND BE SURE TO TELL US** the OS, OS version, compiler
|
||||
and compiler version in which you observed this occurring (in case our OS and
|
||||
compiler produces a different result: so your submission won't be penalized for
|
||||
not meeting your claims).
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
On the other hand, some warnings cannot be disabled and are enabled by compilers
|
||||
without any warning option specified. These are sometimes inevitable in
|
||||
obfuscated code and even in some non-obfuscated code, and you should not worry
|
||||
about this, though it might be worth pointing out.
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
For instance, some compilers like to warn about use of pointers as arrays, which seems to
|
||||
be dubious, as it obviously can't (always) be avoided, being a big part of C, so
|
||||
you should not worry about this either; this is the warning
|
||||
`-Wunsafe-buffer-usage` and the way to disable it is `-Wno-unsafe-buffer-usage`.
|
||||
See also the
|
||||
FAQ on "[forced warnings](../faq.html#forced_warnings)"
|
||||
and the
|
||||
FAQ on "[-Weverything](../faq.html#weverything)".
|
||||
</p>
|
||||
|
||||
<div id="disabling-warnings">
|
||||
## Disabling warnings
|
||||
</div>
|
||||
|
||||
<p class="leftbar">
|
||||
If you do have to disable warnings due to `-Weverything` automatically being
|
||||
included, you might wish to state this fact in your `remarks.md` file.
|
||||
And even without `-Weverything` there can be warnings, as noted above.
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
If your submission issues lots of warnings but is otherwise
|
||||
marvelously obfuscated in multiple levels, don't worry about it. Nevertheless,
|
||||
be sure that the warnings do not constitute a potential "**show stopper**"
|
||||
compiler problem. Be sure that compilers such as both `gcc` and `clang` won't
|
||||
produce a compiler **error** and refuse to compile your code: unless for some
|
||||
reason that is what you intend to happen in which case document that too in your
|
||||
`remarks.md` file. :-)
|
||||
</p>
|
||||
|
||||
All other things being equal, a program that must turn off fewer
|
||||
warnings will be considered better, for certain values of better.
|
||||
|
||||
<p class="leftbar">
|
||||
To turn off a compiler warning, in your submission's `Makefile`,
|
||||
try something such as:
|
||||
</p>
|
||||
|
||||
``` <!---make-->
|
||||
CSILENCE= -Wno-some-thing -Wno-another-thing
|
||||
```
|
||||
|
||||
<p class="leftbar">
|
||||
For instance:
|
||||
</p>
|
||||
|
||||
``` <!---make-->
|
||||
CSILENCE= -Wno-parentheses -Wno-binding-in-condition -Wno-misleading-indentation
|
||||
```
|
||||
|
||||
<p class="leftbar">
|
||||
If you do add "`-Wno-foo`" to your Makefile, consider changing:
|
||||
</p>
|
||||
|
||||
``` <!---make-->
|
||||
CUNKNOWN=
|
||||
```
|
||||
|
||||
<p class="leftbar">
|
||||
to:
|
||||
</p>
|
||||
|
||||
``` <!---make-->
|
||||
CUNKNOWN= -Wno-unknown-warning-option
|
||||
```
|
||||
|
||||
<p class="leftbar">
|
||||
Some compilers have reported this as an error, however, and if you have
|
||||
such a compiler you might want to not add it, or at least note in your
|
||||
`remarks.md` file, which OS, OS version, compiler and compiler version
|
||||
that has such a problem.
|
||||
</p>
|
||||
|
||||
<div id="macros">
|
||||
## Defining macros in the Makefile
|
||||
</div>
|
||||
|
||||
<p class="leftbar">
|
||||
If you need to define something on the compile line, use
|
||||
the `CDEFINE` Makefile variable. For example:
|
||||
</p>
|
||||
|
||||
``` <!---make-->
|
||||
CDEFINE= -Dfoo -Dbar=baz
|
||||
```
|
||||
|
||||
<p class="leftbar">
|
||||
**NOTE**: just because we offer a default way to use the `-D` option, we still
|
||||
do not like excess use of `-D` to get past size limits, especially since you
|
||||
could use `#define` in your code instead.
|
||||
</p>
|
||||
|
||||
<div id="include">
|
||||
## Include files in the Makefile
|
||||
</div>
|
||||
|
||||
<p class="leftbar">
|
||||
If you need to include a file (as in `#include`) on the command line, use the
|
||||
`CINCLUDE` Makefile variable. For example:
|
||||
</p>
|
||||
|
||||
``` <!---make-->
|
||||
CINCLUDE= -include stdio.h
|
||||
```
|
||||
|
||||
|
||||
<div id="magic">
|
||||
## Magic in the Makefile
|
||||
</div>
|
||||
|
||||
<p class="leftbar">
|
||||
If you need to add other "**magic**" flags to your compile line,
|
||||
use the `COTHER` Makefile variable. For example:
|
||||
</p>
|
||||
|
||||
``` <!---make-->
|
||||
COTHER= -fno-math-errno
|
||||
```
|
||||
|
||||
<p class="leftbar">
|
||||
**NOTE**: **We only recommend using "_magic_" flags if _BOTH_ `gcc`
|
||||
_and_ `clang`** support it.
|
||||
</p>
|
||||
|
||||
<p class="leftbar">
|
||||
Again, please note that in macOS, `/usr/bin/gcc` is actually `clang`!
|
||||
</p>
|
||||
|
||||
|
||||
<div id="clobber">
|
||||
## The clobber rule
|
||||
</div>
|
||||
|
||||
<p class="leftbar">
|
||||
When `make clobber` is invoked, we request that submissions be restored
|
||||
to their original submission state. For example, any temporary files
|
||||
(**including** the compiled program(s)) created during the build process, or
|
||||
during execution should be removed by the `clobber` rule. In other words, the
|
||||
only things that should be in the directory after running `make clobber` is what
|
||||
is in your submission tarball itself.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<div id="general">
|
||||
# General Guidelines
|
||||
</div>
|
||||
<div id="general"></div>
|
||||
|
||||
# General Overall Guidelines
|
||||
|
||||
@@ -1541,7 +1190,7 @@ unless you count this one, in which case there are 3. :-)
|
||||
**NOTE**: The previous _guideline_ in this spot has been replaced by this _guideline_:
|
||||
|
||||
<p class="leftbar">
|
||||
> You very well might not be completely prohibited from failing to not partly
|
||||
You very well might not be completely prohibited from failing to not partly
|
||||
misunderstand this particular _guideline_, but of course, we could not possibly
|
||||
comment! :-) Nevertheless, you are neither prohibited, nor are you fully or partly
|
||||
required to determine that this or the previous sentence is either false and/or
|
||||
|
||||
+3
-3
@@ -16826,11 +16826,11 @@
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.ioccc.org/next/guidelines.html</loc>
|
||||
<lastmod>2025-11-29T23:08:54+00:00</lastmod>
|
||||
<lastmod>2025-11-30T01:19:21+00:00</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.ioccc.org/next/guidelines.md</loc>
|
||||
<lastmod>2025-11-29T23:23:33+00:00</lastmod>
|
||||
<lastmod>2025-11-30T01:18:54+00:00</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.ioccc.org/next/index.html</loc>
|
||||
@@ -16938,7 +16938,7 @@
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.ioccc.org/status.html</loc>
|
||||
<lastmod>2025-11-30T00:36:15+00:00</lastmod>
|
||||
<lastmod>2025-11-30T01:25:49+00:00</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.ioccc.org/status.json</loc>
|
||||
|
||||
Reference in new issue
Block a user