Value of EOF

S

S.Tobias

Lawrence Kirby said:
Kenny McCormack wrote:
...
EOF is a macro defined in stdio.h (and other places).

It's only defined in <stdio.h>.

I think the program belows shows that it is defined in other places, too:

#include <stdio.h>

#ifdef EOF
char *s1 = "'ifdef' says EOF is defined here - in "__FILE__;
#else
#error EOF is not defined (1)!
#endif
[...]

No, it doesn't. It merely shows that something, somewhere, has defined
it by the time you hit the #ifdef. It does absolutely nothing to tell
you where it was defined.

They just said that it wasn't defined anywhere other than in stdio.h, and
I disproved that. Obviously, it is defined in my program.

Because <stdio.h> defines it. It is the act of including <stdio.h> which
causes it to be defined. There is nothing else in your program that
defines it.

What the output of your program is saying is that at the point of the
preprocessor tests a definition of EOF is visible. It is not saying that
the definition itself is in your source file.

First Peter Nilsson said the macro EOF was defined [had a definition]
only in <stdio.h>. Then Kenny McCormack said (and gave "a proof")
it was defined [remained defined] elsewhere, too (ie. after
#include <stdio.h>).
In a way, both were right.

At first I thought it was meant to be joke, until you people started
to treat it so seriously. :)
 

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

Members online

No members online now.

Forum statistics

Threads
474,166
Messages
2,570,907
Members
47,448
Latest member
DeanaQ4445

Latest Threads

Top