On Fri, Dec 06, 2002 at 03:30:35PM -0800, david wrote:
> Paul Johnson wrote:
> 
> > But it might.  The behaviour is undefined.  The compiler may do as it
> > will.  Google for "sequence point" if you want to find out more.
> > 
> > The behaviour in Perl is undefined too, but more in the sense that the
> > behaviour has not been defined rather than that the behaviour has been
> > defined as undsefined.
> >
> 
> True, maybe.
> 
> But I don't know what you mean by the behaviour in Perl is undefined.
> To me, the behaviour is well defined (ie, you won't find an exception where 
> the above bahaviour will behaves differently). it's simply $i / $i which 
> always gives you a 1 in Perl except where $i = 0
> david

A couple of years ago, someone not too far away, with a penchant for
starting these kind of threads, asked about:

  $x = 10;
  print ++$x / $x--;  # .909090 (or 10/11)

Jarkko Hietaniemi, who was in charge of creating the 5.8 release, which
was in development at the time, said:

  Yes, but *what* output do you expect?  I think whichever of the 11/10,
  11/9, 10/9, 1, 10/11, 9/11, 9/10, 42, or seven pink elephants dancing
  flamenco on a pinhead you choose, I can argue otherwise.  You say the
  dividend must be evaluated first, I say the divisor, and so on.

I wouldn't rely on the order of evaluation of operands.  It might
change.  At the very least it will be confusing to anyone looking at it.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to