c basics

R

Richard Heathfield

lawryy said:

The first significant technical error occurs in the first program
presented:

+++ quote begins +++

As an extreme example the following C code (mystery.c) is actually legal C
code.
#include

+++ quote ends +++

Whilst it is certainly true that #include is part of the C language (it's a
preprocessor directive), it can't appear on its own like that. Proof:

3.8.2 Source file inclusion

Constraints

A #include directive shall identify a header or source file that
can be processed by the implementation.


Thus, the absence of identification of a header or source file is a
constraint violation which requires the implementation to issue a
diagnostic message. Translation may or may not continue, at the
implementation's discretion; if it continues, the behaviour of the
resulting program is undefined.

When that one's fixed, no doubt you can persuade someone to look for the
second significant technical error. Iterate that process sufficiently
often, and you might end up with a C tutorial that's worth looking at.
But, as it stands, no.
 
K

Keith Thompson

Richard Heathfield said:
lawryy said:


The first significant technical error occurs in the first program
presented:

+++ quote begins +++

As an extreme example the following C code (mystery.c) is actually legal C
code.
#include

+++ quote ends +++

Whilst it is certainly true that #include is part of the C language (it's a
preprocessor directive), it can't appear on its own like that.
[...]

That appears to have been at least partly an HTML error. Looking at the
HTML source of the page, it actually says

<pre>#include <stdio.h><br /><br /><br /></stdio.h></pre>

Probably whatever HTML editor was used thought <stdio.h> was a
directive, and tried to close it; apparently it also lost the rest of
the program. Of course that's not excuse for not bothering to see
what the page actually looks like. A lot of the other examples appear
to have the same problem.

<OT>
For anyone posting C source code in an HTML page, remember that <pre>
doesn't inhibit the interpretation of the '<' character.
</OT>

[...]
 
A

Army1987

Richard said:
lawryy said:


The first significant technical error occurs in the first program
presented:

+++ quote begins +++

As an extreme example the following C code (mystery.c) is actually legal C
code.
#include

+++ quote ends +++
I didn't bother to look at it, but probably they used literal angle
brackets in HTML, where &lt; and &gt; should be used.
 
R

Richard Heathfield

Army1987 said:
I didn't bother to look at it, but probably they used literal angle
brackets in HTML, where &lt; and &gt; should be used.

Well, they can take that up with comp.markup.html if such a beast exists.
The point is not how it's broken - the point is that it *is* broken.

If he fixes this one and tells us, I'll gladly look for another couple of
errors, to help him in his bid for perfection. And if he fixes *those* and
tells us, I may even look for another three.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top