"McKown, John" wrote:

> I guess what Paul was really disappointed in, is that C uses binary zero as 
> the NULL pointer. And it might be nice to be able to use the STOC command to 
> store a value with:
>
>         L       R2,INTVAL
>         LT      R1,POINTER
>       STOC      R2,0(,R1),NZ
>
> instead of:
>
>         LT      R1,POINTER
>         JZ      AROUND
>         L       R2,INTVAL
>         ST      R2,0(,R1)
> AROUND DS       0H
>
> for the C construct:
>
>         if (POINTER != NULL) *POINTER=INTVAL;
>
> I don't know what the C compiler actually generates for that particular code 
> sequence. But the STOC almost seems made-to-order for it.

For the simple non-optimized case, yes, but the C compiler rarely generates 
such simple code for this once optimization is applied. After the compiler 
moves things around to avoid the storage access penalties and address 
interlocks the use of STOC may not be most reasonable choice. Also the 
instruction description points out that the branching code may perform better 
than the conditional store. This is also model dependent.

Regards,
Henry

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to