register variable???

Conor P. Cahill cpcahil at virtech.UUCP
Sat Sep 9 10:16:09 AEST 1989


In article <30585 at srcsip.UUCP>, sklee at pompeii.SRC.Honeywell.COM (Sungkee Lee) writes:
>   printf("list = %d %d %d %d %d\n",
> 	 list[0], list[1], list[2], list[3], list[4]);
>   i = 0;
>   while (i < 4)  list[i] = list[++i];
                   ^^^^^^^^^^^^^^^^^^^^
This is an undefined operation due to the use of i on both sides with 
an auto increment on the right.  There is no definition of the value of
i on the left and that value may change due to the declaration of i
as a register type or a non-register.  

> Is this the way register variable is designed?
> Or, is this compiler error? I ran this program on Sun 3/60?

It is neither.  It is a problem with the code.



More information about the Comp.lang.c mailing list