A question on C programming style

Chris Torek torek at elf.ee.lbl.gov
Sat Apr 13 21:59:13 AEST 1991


In article <1991Apr13.013911.18151 at athena.mit.edu> scs at adam.mit.edu writes:
>Whether nested #included files are good style is, historically,
>(like so many of these style questions :-( ) a bit of a religious
>question.  (ANSI's new guarantees may have shifted the balance
>somewhat.)

Indeed.  One thing, for which I argued (and still will argue---it
seems `right' to me) which is not standard, would tip the balance
all the way:  I believe that `#include' should (always) have been
defined as `read this if you have not already'.

Such a definition would mean that

	#define TABLEENTRY(a, b, c) a
	int atable[] = {
	#include "table"
	};
	#undef TABLEENTRY
	#define TABLEENTRY(a, b, c) c
	int ctable[] = {
	#include "table"
	};
	#undef TABLEENTRY

would fail.  It also leaves open the question of spelling: is

	#include "./table"

`the same' as

	#include "table"

?  All of these would have to have been answered in trial
implementations, which (alas) did not exist when the standard was in
progress, and now no doubt never will.  (My answers would be
`#read'---unconditionally read in a file---and `files are considered
identical only if spelled identically' or `identity of files is
implementation-defined'.)
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek at ee.lbl.gov



More information about the Comp.lang.c mailing list