Are mutually dependent initializations (of externals) portable?

utzoo!decvax!harpo!floyd!cmcl2!philabs!mcvax!guido utzoo!decvax!harpo!floyd!cmcl2!philabs!mcvax!guido
Fri Apr 29 10:28:44 AEST 1983


Could anyone tell me whether the following C construct is portable
beyond Version 7 (PDP-11/45) and 4.1BSD (VAX-11/780) UNIX systems?
On these it works fine, including pcc on the PDP.
I presume it's more or less a loader problem; do other systems have
powerful enough loaders?  (Note that with static instead of external,
it's illegal according to the book AND to the compilers.)
Here's the code:

	typedef struct x XX;
	struct x { XX *p; };
	extern XX a, b;
	XX a = { &b }; /* 'Forward reference'.  Does this work always? */
	XX b = { &a };

PLEASE MAIL TO (...!decvax)!mcvax!guido.

Guido van Rossum, Mathematical Centre, Amsterdam (Holland)



More information about the Comp.lang.c mailing list