Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When sending a struct as a method argument, is it by copy or reference? #7

Open
fabri1983 opened this issue Nov 1, 2019 · 3 comments

Comments

@fabri1983
Copy link

Hi. Silly question I couldn't get answered reading the wiki:
When sending a struct as a method argument, is it by copy or reference?
Thanks in advance.

@Frontear
Copy link

Frontear commented Nov 1, 2019

It is not copied. It passes the pointer address, so it behaves as if it were passed by reference.

Technically it's passing a pointer, but for all intents and purposes, they'll behave more or less similar enough to not care about this subtle difference.

@fabri1983
Copy link
Author

Thanks for the reply.
By the way, there is also info in this post: https://hub.jmonkeyengine.org/t/project-junion-struct-types-for-java/40369/8

@TehLeo
Copy link
Owner

TehLeo commented Nov 6, 2019

Yes, just as Frontear said, structs are passed by reference/pointer/long and not copied.

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

No branches or pull requests

3 participants