errors icon indicating copy to clipboard operation
errors copied to clipboard

return *stack instead of stack

Open simon28082 opened this issue 4 years ago • 2 comments

Hi, I see that the callers in the source code return *stack instead of stack. Why does this happen?

func callers() *stack {
	const depth = 32
	var pcs [depth]uintptr
	n := runtime.Callers(3, pcs[:])
	var st stack = pcs[0:n]
	return &st
}

simon28082 avatar Mar 09 '21 01:03 simon28082

Honestly don’t remember. I can’t think of a reason why it was don’t that way.

davecheney avatar Mar 09 '21 02:03 davecheney

I think because fundamental uses *stack. So it is easier to write stack: callers(). So the question is, why fundamental uses *stack. :-)

mitar avatar Nov 19 '21 13:11 mitar