Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: Notesfiles; site ea.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!inuxc!pur-ee!uiucdcs!ea!jejones
From: jejones@ea.UUCP
Newsgroups: net.lang.c
Subject: close-order manual reading - (nf)
Message-ID: <5700011@ea.UUCP>
Date: Mon, 11-Jun-84 15:24:00 EDT
Article-I.D.: ea.5700011
Posted: Mon Jun 11 15:24:00 1984
Date-Received: Wed, 13-Jun-84 23:43:39 EDT
Lines: 29
Nf-ID: #N:ea:5700011:000:1174
Nf-From: ea!jejones    Jun 11 14:24:00 1984

#N:ea:5700011:000:1174
ea!jejones    Jun 11 14:24:00 1984

Just another note on the C preprocessor and on exegesis from K&R: I had a
program for which I thought I'd write a common macro to report errors, and wrote

	#define error(s) fprintf(stderr, "prog: line %d--%s\n", (s))

to do the job, I thought. Feeling mildly smug, I compiled the program that
contained this #define, and came back with errors. Checking the resuls from
the preprocessor showed that the preprocessor was replacing the s in %s
with the actual parameter when I used the error macro.

Gee, I thought; doesn't the sentence under section 12.1, "Token Replacement,"
on page 207 of K&R,

	Text inside a string or a character constant is not subject
	to replacement.

imply that that shouldn't happen? I thought it did, but experimentation on
a machine running 4.2 BSD (I was using a microcomputer C compiler the first
time around) gave the same results.

The fix to this particular problem is, of course, straightforward, and I
have done it and gone on my way, but I present it here as an example.
To paraphrase Raymond Smullyan, doesn't this make you think that there's
something just a little bit wrong with English specification of semantics?

						James Jones