ANSI proposal for preprocessor strings

Ken Arnold%CGL arnold at ucsfcgl.UUCP
Tue Mar 5 07:37:20 AEST 1985


In article <8768 at brl-tgr.ARPA> gwyn at Brl-Vld.ARPA (VLD/VMB) writes:
>People who are using undocumented behavior of the specific (Reiser)
>implementation of the C preprocessor are the only ones who will have
>a problem with a fully tokenized CPP.  Their code is ALREADY broken,
>even though it appears to work on some systems.  It should not be the
>purpose of the C standards committee to legitimatize existing illegal
>or nonportable use of C, but rather to define what usage IS portable.

Let us say we have a preprocessor command

	# define	FOO(d,e)	printf("%d\n", e)

Now, there are two ways this can be handled on current implementations

	(1)	FOO(x,10) becomes printf("%x\n", 10)
	(2)	FOO(x,10) becomes printf("%d\n", 10)

There are two questions to be asked.  (A) which way is more common, and
(B) which way is more useful.

I will concede that, since there are ways that (B) can be answered
without using method (1), it is not relevant to this question, so I
will just deal with (A).

Most people who have objected to style (1) have stated that it is
undocumented and/or illegal because it is not in K&R, and therefore
should not be codified by the standards committee.

But this is, quite simply, preposterous.  Consider the following
equivalent statement:

	"enum"s are not in K&R.  They must, therefore, be an illegal
	extension, and should not be codified by the standards
	committee.

Now, who out there subscribes to that?  I know several implementations
of C which don't have enums, just as gwyn knows a preprocessor that
doesn't use style (1) (the Reiser style).  But why should that make a
difference?

MOST implementations use enums.  MOST implementations use them
identically.  enum's came from Bell Labs, and have become de facto
standard, and therefore SHOULD be codified by the committee.

Now, reread that statement thusly:

MOST implementations use style (1).  MOST implementations use it
identically.  Reiser's preprocessor  came from Bell Labs, and has
become de facto standard, and therefore SHOULD be codified by the
committee.

If this substitution makes no sense to you, please tell me why.  It
seems quite logical to me.  I have yet to see a reason for excluding
the Resier style which does not exclude enums.
-- 

		Ken Arnold
=================================================================
Of COURSE we can implement your algorithm.  We've got this Turing
machine emulator...



More information about the Comp.lang.c mailing list