🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2036

Re: #pragma

#2036
From: Chris Torek
Date: Sat, 01 Dec 1990 13:20
56 lines
2234 bytes
In article <12570056@hprsue.HP.COM> sue@hprsue.HP.COM (Sue Meloy) writes:
>The only safe thing is for all implementation-specific directives 
>to be protected by ifdefs.

(sounds good to me)

>For example (no noalias diatribes, please!),

Why not? :-)

>do_something(int *vector1, int *vector2)
>#ifdef WHIZBANG_C
>#pragma noalias vector1,vector2
>#endif

I still think `noalias' is a horrible name.  For those who want to
build compilers without automatic alias detection (which is, I admit,
both impossible in general and very slow in the usual possible cases),
I suggest the syntax

	noninterfering(p1, p2, p3, ..., pn)

which means that stores through p1 do not `interfere' with indirection
through any of p2, p3, ..., pn; stores through p2 do not interfere with
indirection through p1, p3, ..., pn; ...; and stores through pn do not
intefere with indirection through p1, p2, ..., pn.

Note that this is a weaker restriction.  It should probably be augmented
to take functions as well:

	noninterfering(p1, munch)

would say that munch() never affects p1[i] for any legal i (and, equivalently,
that p1[i] never affects munch()).

With a special syntax (ick) this same declaration could declare a pointer
or function `pure':

	noninterfering(sin, *)	# sin(x) is a pure function
	noninterfering(ptr, *)	# ptr points to memory not affected by
				# any other pointer or function

It is not clear how to indicate that second-level pointers are pure.
Something along the lines of

	double **x;
	#pragma noninterfering(x, x[*], *)

might declare that not only is x[i] `pure', but also x[i][j].

This syntax could almost certainly be improved.

Oh well, enough of this.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750)
Domain:	chris@cs.umd.edu	Path:	uunet!mimsy!chris
Technical Details
Message-ID: <28178@mimsy.umd.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!europa.asd.contel.com!umd5!haven!mimsy!chris
References: <9011272328.AA03163@decpa.pa.dec.com> <12570056@hprsue.HP.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!europa.asd.contel.com!umd5!haven!mimsy!chris
From: chris@mimsy.umd.edu (Chris Torek)
Newsgroups: comp.std.c
Subject: Re: #pragma
Message-ID: <28178@mimsy.umd.edu>
Date: 1 Dec 90 13:20:26 GMT
References: <9011272328.AA03163@decpa.pa.dec.com> <12570056@hprsue.HP.COM>
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 56