Short code to determine compiler's

Mark Salyzyn mark at adec23.UUCP
Tue Jul 25 06:26:44 AEST 1989


In article <579 at targon.UUCP>, andre at targon.UUCP (andre) writes:
>Yes, I think you can write a program that checks the nr of registers,
> ...
>main()
>{
>	register n1, n2, n3, n4, n5, n6, n7, n8; /* etc. */
>	int *a;
>	a = &n8;
>	/* repeat n6 - n2 */
>	a = &n1;
>}
>You can take the address of a variable but not of a register.

I have several compilers (Aztec C-80, MSC3.0, SYSV cc) that will complain with
ALL of the address taking and only assign a pair of them to registers. I'm
sorry but this is not the answer. I can't even find in the source code of the
C compiler how many registers are used :-).

As far as runtime is concerned, just do a decrement loop on each of the
register variables and check the time. The non-register variables will
take longer to do the loop (probably???). In my next posting I will
divulge the secrets of the Universe :-) :-).

Ciao,
-- Mark Salyzyn



More information about the Comp.lang.c mailing list