Multiple return values

Hey guys, so i’m interested in compiler design and theory have been reading the dragon book, and I was just wondering how the go compiler handles multiple return values as in the underlying data structure, is it an array or slice or something else. I tried searching but nothing came up, does anyone have any ideas? Thanks

AFAIK, the caller allocates stack space for the parameters and return values. So you could say they are handled similarly to the arguments themselves.


cheers for the nudge in the right direction, was thinking about this the wrong way around from a high level perspective not low level. After compiling a simple test program and outputting the assembly with -S i can see they get moved on the stack before RET is called. Thanks for the help.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.