How is type **********p implemented?

Henry Spencer henry at zoo.toronto.edu
Thu Jun 27 03:11:27 AEST 1991


In article <2623 at gold.gvg.tek.com> shaunc at gold.gvg.tek.com (Shaun Case) writes:
>How do C compiler writers implement items like int ***************p, for
>which the target processor has insufficient levels of hardware indirection?

The obvious way, actually.  Most modern processors (anything that ends in
"86" is not modern :-)) have only one level of indirection in their
addressing system.  So if the user declares something like your `p' and
then does `x = ***************p;', the code is the equivalent of:

	tmp1 = *p;
	tmp2 = *tmp1;
	tmp3 = *tmp2;
	...
	x = *tmpn;

In practice, usually all the tmp* will share a single register unless the
hardware has strange ideas about data types.
-- 
"We're thinking about upgrading from    | Henry Spencer @ U of Toronto Zoology
SunOS 4.1.1 to SunOS 3.5."              |  henry at zoo.toronto.edu  utzoo!henry



More information about the Comp.lang.c mailing list