[m-dev.] diff: bootstrap problem with init files in hlc grade

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Nov 8 16:20:04 AEDT 2000


On 08-Nov-2000, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> On 08-Nov-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > Well, that might justify having the functions generated.
> > But it doesn't justify them having non-empty contents.
> > In particular the calls to MR_init_entry() that do nothing go against
> > the MLDS philosophy of not relying on macros and #ifdef.
> 
> Where is this philosophy documented? I couldn't find it.

I've mentioned it a couple of times on this list,
<http://www.cs.mu.oz.au/mercury/mailing-lists/mercury-developers/mercury-developers.0010/0101.html>
<http://www.cs.mu.oz.au/mercury/mailing-lists/mercury-developers/mercury-developers.0008/0021.html>
but I don't think it is explicitly documented in the source code.

> > Also the stuff fooling around with `static int initialized' certainly
> > doesn't improve the readability.
> 
> I don't know what "fooling around" refers to.

Here's an extract from what we currently generate for samples/hello.m:

	void mercury__hello__init_type_tables(void)
	{
		static int initialised = 0;
		if (initialised) return;
		initialised = 1;


	}

Since the body of the function is empty, the three lines that
reference `initialised' have no effect.  (GNU C is however not able to
optimize them away, so this affects efficiency as well as readability.)

> If you want to make the contents of the mercury__<module>__init function
> physically empty in grades in which its contents would be #defined to the empty
> string anyway, go ahead

Shall do.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list