Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Unexpected Result (left to right paramater passing)

  • Please log in to reply
61 replies to this topic
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

Is this just an intellectual exercise, a challenge?

I did it mainly for fun. I like figuring out things, especially doing it in ad hoc way as it usually amplifies the fun to the extreme. So, I avoided reading the source etc as it would greatly reduce the fun, which will become the next step to take if I'm really serious about it.

  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
This was an interesting discussion. Since I don't think it would be easy to change this behavior (especially not without giving up performance), I've added the following to the functions page:

If a parameter in a function-call resolves to a variable (e.g. Var or ++Var or Var*=2), other parameters to its left or right can alter that variable before it is passed to the function. For example, func(Var, Var++) would unexpectedly pass 1, 0 when Var is initially 0, even when the function's first parameter is not ByRef. Since this behavior is counterintuitive, it might change in a future release.

Sorry for the confusion.