My comments to X3J11 (1000 lines)

mat at mtx5a.UUCP mat at mtx5a.UUCP
Wed Jan 14 04:45:41 AEST 1987


> These are comments I'm about to mail to CBEMA:
> 
> I have implemented what I believe is a complete freestanding
> implementation of this draft, except for the insuperable problem
> described in item 1, ...
> 
> Disastrous Deficiencies.
> 
> ...
> Support for arbitrary casts and arithmetic in static initializers
> also requires changes to linkers.  Consider
> 
>     int foo = ((int)&bar * 3) % 5001 | (int)&baz;
> 
> The Rationale in 3.4 suggests that this initial value be computed and
> installed at run time.  However, this is usually impossible.  Just
> generating instructions to compute the value and store it is easy; the
> problem is how to cause them to be executed at a suitable time.  The
> value of `foo' could be examined by code in a different source file
> before any function in this source file has been called.  Only a
> special linker feature would make it possible for each separate
> compilation to specify code to be executed before `main' is called.

This is the problem faced by C++ in dealing with ``static constructors.''
Solutions are being found; they are generally dependent upon the machine
environment, but the problem is not insurmountable, at least on the machines
that C++ has thus far been ported to.  I suspect that there is even a solution
for the HP3000, and that is a bad machine to write language systems for (the
linker must be a trusted program to protect the system.)
-- 

	from Mole End			Mark Terribile
		(scrape .. dig )	mtx5b!mat
					(Please mail to mtx5b!mat, NOT mtx5a!
						mat, or to mtx5a!mtx5b!mat)
					(mtx5b!mole-end!mat will also reach me)
    ,..      .,,       ,,,   ..,***_*.



More information about the Comp.lang.c mailing list