Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

return *stack instead of stack #237

Open
simon28082 opened this issue Mar 9, 2021 · 2 comments
Open

return *stack instead of stack #237

simon28082 opened this issue Mar 9, 2021 · 2 comments

Comments

@simon28082
Copy link

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
}
@davecheney
Copy link
Member

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

@mitar
Copy link

mitar commented Nov 19, 2021

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants