in reply to Re^6: Sorting, recursion, and tail-call optimizations
in thread Sorting, recursion, and tail-call optimizations
You miss my point. I'm not talking about $a & $b.
When the comparator is first called, if no parameters are passed, then @_ should be empty and $_[0] is "undefined". That's not undefined, but undefined in the non-useful, undefinable, implementation dependant, DO NOT USE sense.
$_[0] obviously is pointing (aliasing) somewhere, but where?
My best guess is that @_ contains the contents of the previous stack frame. Ie. the contents of @_ when the comparator is called, are the same as those passed to the function that is calling the comparator. which would be sort.
In which case, you are probably incrementing the address of the comparator itself--which would at least explain why it blows up!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Sorting, recursion, and tail-call optimizations
by Limbic~Region (Chancellor) on Jan 06, 2006 at 18:45 UTC | |
by BrowserUk (Patriarch) on Jan 06, 2006 at 19:07 UTC | |
by Limbic~Region (Chancellor) on Jan 06, 2006 at 19:14 UTC | |
by BrowserUk (Patriarch) on Jan 06, 2006 at 19:39 UTC |