This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Small web / my contrib update
- From: John Marshall <jmarshall at acm dot org>
- To: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Cc: gcc-patches at gcc dot gnu dot org, Gerald Pfeifer <pfeifer at dbai dot tuwien dot ac dot at>
- Date: Tue, 14 May 2002 10:47:51 +0200
- Subject: Re: Small web / my contrib update
- References: <20020513213647.GA17535@daikokuya.demon.co.uk>
On Mon, May 13, 2002 at 10:36:47PM +0100, Neil Booth wrote:
> I was reading bugs.html today and noticed an out-of-date claim.
While somebody's there :-), how about fixing the examples so they make
sense? At the moment (at least with Mozilla) they come out all on one
line:
memcpy(dest, src, #ifdef PLATFORM1 12 #else 24 #endif );
Fixed below. (I don't have write access, so please commit it if it's
acceptable.)
John
* wwwdocs/htdocs/bugs.html: Format multi-line code snippets
correctly. Using <pre> instead of <code> and <br> also
preserves spaces used as indentation.
--- bugs.html.orig Tue May 14 10:13:20 2002
+++ bugs.html Tue May 14 10:19:38 2002
@@ -315,11 +315,11 @@
<dd><p>This has nothing to do with GCC, but people ask us about it a
lot. Code like this:</p>
-<blockquote><code>
- #include <stdio.h>
+<blockquote><pre>
+#include <stdio.h>
- FILE *yyin = stdin;
-</code></blockquote>
+FILE *yyin = stdin;
+</pre></blockquote>
<p>will not compile with GNU libc (GNU/Linux libc6), because
<code>stdin</code> is not a constant. This was done deliberately, to make
@@ -342,7 +342,7 @@
<dt><em>Cannot use preprocessor directive in macro arguments.</em></dt>
<dd><p>Let me guess... you wrote code that looks something like this:</p>
-<blockquote><code>
+<blockquote><pre>
memcpy(dest, src,
#ifdef PLATFORM1
12
@@ -350,7 +350,7 @@
24
#endif
);
-</code></blockquote>
+</pre></blockquote>
<p>and you got a whole pile of error messages:</p>
<blockquote><code>
@@ -383,13 +383,13 @@
different things with it. It is always possible to rewrite code which
uses conditionals inside macros so that it doesn't. You could write
the above example</p>
-<blockquote><code>
-#ifdef PLATFORM1<br />
- memcpy(dest, src, 12);<br />
-#else<br />
- memcpy(dest, src, 24);<br />
-#endif<br />
-</code></blockquote>
+<blockquote><pre>
+#ifdef PLATFORM1
+ memcpy(dest, src, 12);
+#else
+ memcpy(dest, src, 24);
+#endif
+</pre></blockquote>
<p>This is a bit more typing, but I personally think it's better style
in addition to being more portable.</p>