What's implementation defined?

Henry Spencer henry at utzoo.uucp
Tue Dec 6 04:17:53 AEST 1988


In article <9064 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>I don't see that this example is at all on thin ice.  Using the
>implementation definition, a definite header name must be produced,
>or else it is illegal syntax.  The syntax for #include is spelled out.
>Also what happens once has a header name is spelled out....

Consider a more complete example:

	#define x <
	#define y stdio.h
	#define z >
	#include x y z

Since the combination mechanism in the #include is implementation-defined,
this might turn into any of the following:

	#include <stdio.h>
	#include < stdio . h >
	#include <\stdio\.\h>
	#include <forget.it>

(The last is arguably unreasonable, but it is not *clear* that the standard
actually forbids it.)  The point is, the construct is required to be legal
but is not required to be useful, which makes it pretty, uh, useless in
portable programs.  This is actually a bit curious, since elsewhere (the
# operator, and arguably the ## operator), exact preservation of the
original spelling of tokens is in fact demanded.  Was there a reason why
a similar demand was considered impractical or undesirable here?
-- 
SunOSish, adj:  requiring      |     Henry Spencer at U of Toronto Zoology
32-bit bug numbers.            | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.std.c mailing list