Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!ucbvax!hplabs!hpda!hpcupt1!jwolf From: jwolf@hpcupt1.HP.COM (John Wolf) Newsgroups: comp.lang.pascal Subject: Re: C Ternary Conditional Expression? Message-ID: <7020003@hpcupt1.HP.COM> Date: 24 May 89 17:29:35 GMT References: <950025@hpclcdb.HP.COM> Organization: Hewlett Packard, Cupertino Lines: 20 The following pascal statement is a more elegant way of expressing the above C statement, one less stack variable is used (i.e. no temporary variable is required)... IF (indx = last_indx) THEN a[last_val] := a[y] ELSE a[f(indx)] := a[y]; However, the machine code emitted for the C statement mostly matches the paradigm of Pascal statements you specified: IF (indx = last_indx) THEN temp := last_val ELSE temp := f(indx); a[temp] := a[y]; i.e. a temporary variable (or register) is set in the context of a conditional branch and is later dereferenced as an array index. John Wolf / x74682 / jwolf@hpda.HP.COM